Line data Source code
1 : // Copyright 2011 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_X64_CODEGEN_X64_H_
6 : #define V8_X64_CODEGEN_X64_H_
7 :
8 : #include "src/macro-assembler.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 :
14 : class StringCharLoadGenerator : public AllStatic {
15 : public:
16 : // Generates the code for handling different string types and loading the
17 : // indexed character into |result|. We expect |index| as untagged input and
18 : // |result| as untagged output.
19 : static void Generate(MacroAssembler* masm,
20 : Register string,
21 : Register index,
22 : Register result,
23 : Label* call_runtime);
24 :
25 : private:
26 : DISALLOW_COPY_AND_ASSIGN(StringCharLoadGenerator);
27 : };
28 :
29 :
30 : enum StackArgumentsAccessorReceiverMode {
31 : ARGUMENTS_CONTAIN_RECEIVER,
32 : ARGUMENTS_DONT_CONTAIN_RECEIVER
33 : };
34 :
35 :
36 : class StackArgumentsAccessor BASE_EMBEDDED {
37 : public:
38 : StackArgumentsAccessor(
39 : Register base_reg,
40 : int argument_count_immediate,
41 : StackArgumentsAccessorReceiverMode receiver_mode =
42 : ARGUMENTS_CONTAIN_RECEIVER,
43 : int extra_displacement_to_last_argument = 0)
44 : : base_reg_(base_reg),
45 : argument_count_reg_(no_reg),
46 : argument_count_immediate_(argument_count_immediate),
47 : receiver_mode_(receiver_mode),
48 : extra_displacement_to_last_argument_(
49 6773 : extra_displacement_to_last_argument) { }
50 :
51 : StackArgumentsAccessor(
52 : Register base_reg,
53 : Register argument_count_reg,
54 : StackArgumentsAccessorReceiverMode receiver_mode =
55 : ARGUMENTS_CONTAIN_RECEIVER,
56 : int extra_displacement_to_last_argument = 0)
57 : : base_reg_(base_reg),
58 : argument_count_reg_(argument_count_reg),
59 : argument_count_immediate_(0),
60 : receiver_mode_(receiver_mode),
61 : extra_displacement_to_last_argument_(
62 1707 : extra_displacement_to_last_argument) { }
63 :
64 : StackArgumentsAccessor(
65 : Register base_reg,
66 : const ParameterCount& parameter_count,
67 : StackArgumentsAccessorReceiverMode receiver_mode =
68 : ARGUMENTS_CONTAIN_RECEIVER,
69 : int extra_displacement_to_last_argument = 0)
70 : : base_reg_(base_reg),
71 : argument_count_reg_(parameter_count.is_reg() ?
72 : parameter_count.reg() : no_reg),
73 : argument_count_immediate_(parameter_count.is_immediate() ?
74 : parameter_count.immediate() : 0),
75 : receiver_mode_(receiver_mode),
76 : extra_displacement_to_last_argument_(
77 : extra_displacement_to_last_argument) { }
78 :
79 : Operand GetArgumentOperand(int index);
80 : Operand GetReceiverOperand() {
81 : DCHECK(receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER);
82 1241 : return GetArgumentOperand(0);
83 : }
84 :
85 : private:
86 : const Register base_reg_;
87 : const Register argument_count_reg_;
88 : const int argument_count_immediate_;
89 : const StackArgumentsAccessorReceiverMode receiver_mode_;
90 : const int extra_displacement_to_last_argument_;
91 :
92 : DISALLOW_IMPLICIT_CONSTRUCTORS(StackArgumentsAccessor);
93 : };
94 :
95 :
96 : } // namespace internal
97 : } // namespace v8
98 :
99 : #endif // V8_X64_CODEGEN_X64_H_
|