OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ | 5 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ |
6 #define V8_BUILTINS_BUILTINS_UTILS_H_ | 6 #define V8_BUILTINS_BUILTINS_UTILS_H_ |
7 | 7 |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/builtins/builtins.h" | 10 #include "src/builtins/builtins.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // ... | 114 // ... |
115 // } | 115 // } |
116 // | 116 // |
117 // In the body of the builtin function the arguments can be accessed | 117 // In the body of the builtin function the arguments can be accessed |
118 // as "Parameter(n)". | 118 // as "Parameter(n)". |
119 #define TF_BUILTIN(Name, AssemblerBase) \ | 119 #define TF_BUILTIN(Name, AssemblerBase) \ |
120 class Name##Assembler : public AssemblerBase { \ | 120 class Name##Assembler : public AssemblerBase { \ |
121 public: \ | 121 public: \ |
122 explicit Name##Assembler(compiler::CodeAssemblerState* state) \ | 122 explicit Name##Assembler(compiler::CodeAssemblerState* state) \ |
123 : AssemblerBase(state) {} \ | 123 : AssemblerBase(state) {} \ |
124 void Generate##NameImpl(); \ | 124 void Generate##Name##Impl(); \ |
125 }; \ | 125 }; \ |
126 void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ | 126 void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ |
127 Name##Assembler assembler(state); \ | 127 Name##Assembler assembler(state); \ |
128 assembler.Generate##NameImpl(); \ | 128 assembler.Generate##Name##Impl(); \ |
129 } \ | 129 } \ |
130 void Name##Assembler::Generate##NameImpl() | 130 void Name##Assembler::Generate##Name##Impl() |
131 | 131 |
132 // ---------------------------------------------------------------------------- | 132 // ---------------------------------------------------------------------------- |
133 | 133 |
134 #define CHECK_RECEIVER(Type, name, method) \ | 134 #define CHECK_RECEIVER(Type, name, method) \ |
135 if (!args.receiver()->Is##Type()) { \ | 135 if (!args.receiver()->Is##Type()) { \ |
136 THROW_NEW_ERROR_RETURN_FAILURE( \ | 136 THROW_NEW_ERROR_RETURN_FAILURE( \ |
137 isolate, \ | 137 isolate, \ |
138 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ | 138 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ |
139 isolate->factory()->NewStringFromAsciiChecked(method), \ | 139 isolate->factory()->NewStringFromAsciiChecked(method), \ |
140 args.receiver())); \ | 140 args.receiver())); \ |
(...skipping 11 matching lines...) Expand all Loading... |
152 isolate->factory()->NewStringFromAsciiChecked(method))); \ | 152 isolate->factory()->NewStringFromAsciiChecked(method))); \ |
153 } \ | 153 } \ |
154 Handle<String> name; \ | 154 Handle<String> name; \ |
155 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ | 155 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ |
156 isolate, name, Object::ToString(isolate, args.receiver())) | 156 isolate, name, Object::ToString(isolate, args.receiver())) |
157 | 157 |
158 } // namespace internal | 158 } // namespace internal |
159 } // namespace v8 | 159 } // namespace v8 |
160 | 160 |
161 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ | 161 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ |
OLD | NEW |