Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: src/builtins/builtins-utils.h

Issue 2529873002: Revert of [cleanup] Refactor builtins-number.cc (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-number.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return Builtin_Impl_Stats_##name(args_length, args_object, isolate); \ 95 return Builtin_Impl_Stats_##name(args_length, args_object, isolate); \
96 } \ 96 } \
97 BuiltinArguments args(args_length, args_object); \ 97 BuiltinArguments args(args_length, args_object); \
98 return Builtin_Impl_##name(args, isolate); \ 98 return Builtin_Impl_##name(args, isolate); \
99 } \ 99 } \
100 \ 100 \
101 MUST_USE_RESULT static Object* Builtin_Impl_##name(BuiltinArguments args, \ 101 MUST_USE_RESULT static Object* Builtin_Impl_##name(BuiltinArguments args, \
102 Isolate* isolate) 102 Isolate* isolate)
103 103
104 // ---------------------------------------------------------------------------- 104 // ----------------------------------------------------------------------------
105 // Support macro for defining builtins with Turbofan.
106 // ----------------------------------------------------------------------------
107 //
108 // A builtin function is defined by writing:
109 //
110 // TF_BUILTIN(name, code_assember_base_class) {
111 // ...
112 // }
113 //
114 // In the body of the builtin function the arguments can be accessed
115 // as "Parameter(n)".
116 #define TF_BUILTIN(Name, AssemblerBase) \
117 class Name##Assembler : public AssemblerBase { \
118 public: \
119 explicit Name##Assembler(compiler::CodeAssemblerState* state) \
120 : AssemblerBase(state) {} \
121 void Generate##Name(); \
122 }; \
123 void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \
124 Name##Assembler assembler(state); \
125 assembler.Generate##Name(); \
126 } \
127 void Name##Assembler::Generate##Name()
128
129 // ----------------------------------------------------------------------------
130 105
131 #define CHECK_RECEIVER(Type, name, method) \ 106 #define CHECK_RECEIVER(Type, name, method) \
132 if (!args.receiver()->Is##Type()) { \ 107 if (!args.receiver()->Is##Type()) { \
133 THROW_NEW_ERROR_RETURN_FAILURE( \ 108 THROW_NEW_ERROR_RETURN_FAILURE( \
134 isolate, \ 109 isolate, \
135 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ 110 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \
136 isolate->factory()->NewStringFromAsciiChecked(method), \ 111 isolate->factory()->NewStringFromAsciiChecked(method), \
137 args.receiver())); \ 112 args.receiver())); \
138 } \ 113 } \
139 Handle<Type> name = Handle<Type>::cast(args.receiver()) 114 Handle<Type> name = Handle<Type>::cast(args.receiver())
(...skipping 10 matching lines...) Expand all
150 isolate->factory()->NewStringFromAsciiChecked(method))); \ 125 isolate->factory()->NewStringFromAsciiChecked(method))); \
151 } \ 126 } \
152 Handle<String> name; \ 127 Handle<String> name; \
153 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ 128 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
154 isolate, name, Object::ToString(isolate, args.receiver())) 129 isolate, name, Object::ToString(isolate, args.receiver()))
155 130
156 } // namespace internal 131 } // namespace internal
157 } // namespace v8 132 } // namespace v8
158 133
159 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ 134 #endif // V8_BUILTINS_BUILTINS_UTILS_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-number.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698