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

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

Issue 2517833005: [cleanup] Refactor builtins-number.cc (Closed)
Patch Set: ready for review 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 // ----------------------------------------------------------------------------
105 130
106 #define CHECK_RECEIVER(Type, name, method) \ 131 #define CHECK_RECEIVER(Type, name, method) \
107 if (!args.receiver()->Is##Type()) { \ 132 if (!args.receiver()->Is##Type()) { \
108 THROW_NEW_ERROR_RETURN_FAILURE( \ 133 THROW_NEW_ERROR_RETURN_FAILURE( \
109 isolate, \ 134 isolate, \
110 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ 135 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \
111 isolate->factory()->NewStringFromAsciiChecked(method), \ 136 isolate->factory()->NewStringFromAsciiChecked(method), \
112 args.receiver())); \ 137 args.receiver())); \
113 } \ 138 } \
114 Handle<Type> name = Handle<Type>::cast(args.receiver()) 139 Handle<Type> name = Handle<Type>::cast(args.receiver())
(...skipping 10 matching lines...) Expand all
125 isolate->factory()->NewStringFromAsciiChecked(method))); \ 150 isolate->factory()->NewStringFromAsciiChecked(method))); \
126 } \ 151 } \
127 Handle<String> name; \ 152 Handle<String> name; \
128 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ 153 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
129 isolate, name, Object::ToString(isolate, args.receiver())) 154 isolate, name, Object::ToString(isolate, args.receiver()))
130 155
131 } // namespace internal 156 } // namespace internal
132 } // namespace v8 157 } // namespace v8
133 158
134 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ 159 #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