| 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 name##ArgumentsType args, Isolate* isolate) { \ | 132 int args_length, Object** args_object, Isolate* isolate) { \ |
| 133 ASSERT(isolate == Isolate::Current()); \ | 133 name##ArgumentsType args(args_length, args_object); \ |
| 134 args.Verify(); \ | 134 ASSERT(isolate == Isolate::Current()); \ |
| 135 return Builtin_Impl_##name(args, isolate); \ | 135 args.Verify(); \ |
| 136 } \ | 136 return Builtin_Impl_##name(args, isolate); \ |
| 137 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ | 137 } \ |
| 138 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ |
| 138 name##ArgumentsType args, Isolate* isolate) | 139 name##ArgumentsType args, Isolate* isolate) |
| 139 | 140 |
| 140 #else // For release mode. | 141 #else // For release mode. |
| 141 | 142 |
| 142 #define BUILTIN(name) \ | 143 #define BUILTIN(name) \ |
| 143 static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate) | 144 static MaybeObject* Builtin_impl##name( \ |
| 144 | 145 name##ArgumentsType args, Isolate* isolate); \ |
| 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) |
| 145 #endif | 153 #endif |
| 146 | 154 |
| 147 | 155 |
| 148 static inline bool CalledAsConstructor(Isolate* isolate) { | 156 static inline bool CalledAsConstructor(Isolate* isolate) { |
| 149 #ifdef DEBUG | 157 #ifdef DEBUG |
| 150 // Calculate the result using a full stack frame iterator and check | 158 // Calculate the result using a full stack frame iterator and check |
| 151 // that the state of the stack is as we assume it to be in the | 159 // that the state of the stack is as we assume it to be in the |
| 152 // code below. | 160 // code below. |
| 153 StackFrameIterator it(isolate); | 161 StackFrameIterator it(isolate); |
| 154 ASSERT(it.frame()->is_exit()); | 162 ASSERT(it.frame()->is_exit()); |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 return Handle<Code>(code_address); \ | 1873 return Handle<Code>(code_address); \ |
| 1866 } | 1874 } |
| 1867 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1875 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1868 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1876 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1869 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1877 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1870 #undef DEFINE_BUILTIN_ACCESSOR_C | 1878 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1871 #undef DEFINE_BUILTIN_ACCESSOR_A | 1879 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1872 | 1880 |
| 1873 | 1881 |
| 1874 } } // namespace v8::internal | 1882 } } // namespace v8::internal |
| OLD | NEW |