| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 static MaybeObject* Builtin_##name( \ | 146 static MaybeObject* Builtin_##name( \ |
| 147 int args_length, Object** args_object, Isolate* isolate) { \ | 147 int args_length, Object** args_object, Isolate* isolate) { \ |
| 148 name##ArgumentsType args(args_length, args_object); \ | 148 name##ArgumentsType args(args_length, args_object); \ |
| 149 return Builtin_impl##name(args, isolate); \ | 149 return Builtin_impl##name(args, isolate); \ |
| 150 } \ | 150 } \ |
| 151 static MaybeObject* Builtin_impl##name( \ | 151 static MaybeObject* Builtin_impl##name( \ |
| 152 name##ArgumentsType args, Isolate* isolate) | 152 name##ArgumentsType args, Isolate* isolate) |
| 153 #endif | 153 #endif |
| 154 | 154 |
| 155 | 155 |
| 156 #ifdef DEBUG |
| 156 static inline bool CalledAsConstructor(Isolate* isolate) { | 157 static inline bool CalledAsConstructor(Isolate* isolate) { |
| 157 #ifdef DEBUG | |
| 158 // Calculate the result using a full stack frame iterator and check | 158 // 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 | 159 // that the state of the stack is as we assume it to be in the |
| 160 // code below. | 160 // code below. |
| 161 StackFrameIterator it(isolate); | 161 StackFrameIterator it(isolate); |
| 162 ASSERT(it.frame()->is_exit()); | 162 ASSERT(it.frame()->is_exit()); |
| 163 it.Advance(); | 163 it.Advance(); |
| 164 StackFrame* frame = it.frame(); | 164 StackFrame* frame = it.frame(); |
| 165 bool reference_result = frame->is_construct(); | 165 bool reference_result = frame->is_construct(); |
| 166 #endif | |
| 167 Address fp = Isolate::c_entry_fp(isolate->thread_local_top()); | 166 Address fp = Isolate::c_entry_fp(isolate->thread_local_top()); |
| 168 // Because we know fp points to an exit frame we can use the relevant | 167 // Because we know fp points to an exit frame we can use the relevant |
| 169 // part of ExitFrame::ComputeCallerState directly. | 168 // part of ExitFrame::ComputeCallerState directly. |
| 170 const int kCallerOffset = ExitFrameConstants::kCallerFPOffset; | 169 const int kCallerOffset = ExitFrameConstants::kCallerFPOffset; |
| 171 Address caller_fp = Memory::Address_at(fp + kCallerOffset); | 170 Address caller_fp = Memory::Address_at(fp + kCallerOffset); |
| 172 // This inlines the part of StackFrame::ComputeType that grabs the | 171 // This inlines the part of StackFrame::ComputeType that grabs the |
| 173 // type of the current frame. Note that StackFrame::ComputeType | 172 // type of the current frame. Note that StackFrame::ComputeType |
| 174 // has been specialized for each architecture so if any one of them | 173 // has been specialized for each architecture so if any one of them |
| 175 // changes this code has to be changed as well. | 174 // changes this code has to be changed as well. |
| 176 const int kMarkerOffset = StandardFrameConstants::kMarkerOffset; | 175 const int kMarkerOffset = StandardFrameConstants::kMarkerOffset; |
| 177 const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT); | 176 const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT); |
| 178 Object* marker = Memory::Object_at(caller_fp + kMarkerOffset); | 177 Object* marker = Memory::Object_at(caller_fp + kMarkerOffset); |
| 179 bool result = (marker == kConstructMarker); | 178 bool result = (marker == kConstructMarker); |
| 180 ASSERT_EQ(result, reference_result); | 179 ASSERT_EQ(result, reference_result); |
| 181 return result; | 180 return result; |
| 182 } | 181 } |
| 182 #endif |
| 183 | 183 |
| 184 | 184 |
| 185 // ---------------------------------------------------------------------------- | 185 // ---------------------------------------------------------------------------- |
| 186 | 186 |
| 187 BUILTIN(Illegal) { | 187 BUILTIN(Illegal) { |
| 188 UNREACHABLE(); | 188 UNREACHABLE(); |
| 189 return isolate->heap()->undefined_value(); // Make compiler happy. | 189 return isolate->heap()->undefined_value(); // Make compiler happy. |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 } | 1787 } |
| 1788 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1788 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1789 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1789 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1790 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1790 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1791 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1791 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1792 #undef DEFINE_BUILTIN_ACCESSOR_C | 1792 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1793 #undef DEFINE_BUILTIN_ACCESSOR_A | 1793 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1794 | 1794 |
| 1795 | 1795 |
| 1796 } } // namespace v8::internal | 1796 } } // namespace v8::internal |
| OLD | NEW |