OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // | 118 // |
119 // BUILTIN(name) { | 119 // BUILTIN(name) { |
120 // ... | 120 // ... |
121 // } | 121 // } |
122 // | 122 // |
123 // In the body of the builtin function the arguments can be accessed | 123 // In the body of the builtin function the arguments can be accessed |
124 // through the BuiltinArguments object args. | 124 // through the BuiltinArguments object args. |
125 | 125 |
126 #ifdef DEBUG | 126 #ifdef DEBUG |
127 | 127 |
128 #define BUILTIN(name) \ | 128 #define BUILTIN(name) \ |
129 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ | 129 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ |
130 name##ArgumentsType args, Isolate* isolate); \ | 130 name##ArgumentsType args, Isolate* isolate); \ |
131 MUST_USE_RESULT static MaybeObject* Builtin_##name( \ | 131 MUST_USE_RESULT static MaybeObject* Builtin_##name( \ |
132 int args_length, Object** args_object, Isolate* isolate) { \ | 132 name##ArgumentsType args, Isolate* isolate) { \ |
133 name##ArgumentsType args(args_length, args_object); \ | 133 ASSERT(isolate == Isolate::Current()); \ |
134 ASSERT(isolate == Isolate::Current()); \ | 134 args.Verify(); \ |
135 args.Verify(); \ | 135 return Builtin_Impl_##name(args, isolate); \ |
136 return Builtin_Impl_##name(args, isolate); \ | 136 } \ |
137 } \ | 137 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ |
138 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ | |
139 name##ArgumentsType args, Isolate* isolate) | 138 name##ArgumentsType args, Isolate* isolate) |
140 | 139 |
141 #else // For release mode. | 140 #else // For release mode. |
142 | 141 |
143 #define BUILTIN(name) \ | 142 #define BUILTIN(name) \ |
144 static MaybeObject* Builtin_impl##name( \ | 143 static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate) |
145 name##ArgumentsType args, Isolate* isolate); \ | 144 |
146 static MaybeObject* Builtin_##name( \ | |
147 int args_length, Object** args_object, Isolate* isolate) { \ | |
148 name##ArgumentsType args(args_length, args_object); \ | |
149 return Builtin_impl##name(args, isolate); \ | |
150 } \ | |
151 static MaybeObject* Builtin_impl##name( \ | |
152 name##ArgumentsType args, Isolate* isolate) | |
153 #endif | 145 #endif |
154 | 146 |
155 | 147 |
156 static inline bool CalledAsConstructor(Isolate* isolate) { | 148 static inline bool CalledAsConstructor(Isolate* isolate) { |
157 #ifdef DEBUG | 149 #ifdef DEBUG |
158 // Calculate the result using a full stack frame iterator and check | 150 // Calculate the result using a full stack frame iterator and check |
159 // that the state of the stack is as we assume it to be in the | 151 // that the state of the stack is as we assume it to be in the |
160 // code below. | 152 // code below. |
161 StackFrameIterator it(isolate); | 153 StackFrameIterator it(isolate); |
162 ASSERT(it.frame()->is_exit()); | 154 ASSERT(it.frame()->is_exit()); |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 return Handle<Code>(code_address); \ | 1867 return Handle<Code>(code_address); \ |
1876 } | 1868 } |
1877 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1869 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1878 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1870 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1879 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1871 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1880 #undef DEFINE_BUILTIN_ACCESSOR_C | 1872 #undef DEFINE_BUILTIN_ACCESSOR_C |
1881 #undef DEFINE_BUILTIN_ACCESSOR_A | 1873 #undef DEFINE_BUILTIN_ACCESSOR_A |
1882 | 1874 |
1883 | 1875 |
1884 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
OLD | NEW |