| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 CHECK(func->IsFunction()); | 207 CHECK(func->IsFunction()); |
| 208 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func)); | 208 JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func)); |
| 209 return IsAddressWithinFuncCode(js_func, addr); | 209 return IsAddressWithinFuncCode(js_func, addr); |
| 210 } | 210 } |
| 211 | 211 |
| 212 | 212 |
| 213 // This C++ function is called as a constructor, to grab the frame pointer | 213 // This C++ function is called as a constructor, to grab the frame pointer |
| 214 // from the calling function. When this function runs, the stack contains | 214 // from the calling function. When this function runs, the stack contains |
| 215 // a C_Entry frame and a Construct frame above the calling function's frame. | 215 // a C_Entry frame and a Construct frame above the calling function's frame. |
| 216 static v8::Handle<Value> construct_call(const v8::Arguments& args) { | 216 static v8::Handle<Value> construct_call(const v8::Arguments& args) { |
| 217 i::StackFrameIterator frame_iterator; | 217 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); |
| 218 i::StackFrameIterator frame_iterator(isolate); |
| 218 CHECK(frame_iterator.frame()->is_exit()); | 219 CHECK(frame_iterator.frame()->is_exit()); |
| 219 frame_iterator.Advance(); | 220 frame_iterator.Advance(); |
| 220 CHECK(frame_iterator.frame()->is_construct()); | 221 CHECK(frame_iterator.frame()->is_construct()); |
| 221 frame_iterator.Advance(); | 222 frame_iterator.Advance(); |
| 222 i::StackFrame* calling_frame = frame_iterator.frame(); | 223 i::StackFrame* calling_frame = frame_iterator.frame(); |
| 223 CHECK(calling_frame->is_java_script()); | 224 CHECK(calling_frame->is_java_script()); |
| 224 | 225 |
| 225 #if defined(V8_HOST_ARCH_32_BIT) | 226 #if defined(V8_HOST_ARCH_32_BIT) |
| 226 int32_t low_bits = reinterpret_cast<int32_t>(calling_frame->fp()); | 227 int32_t low_bits = reinterpret_cast<int32_t>(calling_frame->fp()); |
| 227 args.This()->Set(v8_str("low_bits"), v8_num(low_bits >> 1)); | 228 args.This()->Set(v8_str("low_bits"), v8_num(low_bits >> 1)); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 InitializeVM(); | 404 InitializeVM(); |
| 404 v8::HandleScope scope; | 405 v8::HandleScope scope; |
| 405 CHECK_EQ(0, GetJsEntrySp()); | 406 CHECK_EQ(0, GetJsEntrySp()); |
| 406 CompileRun("a = 1; b = a + 1;"); | 407 CompileRun("a = 1; b = a + 1;"); |
| 407 CHECK_EQ(0, GetJsEntrySp()); | 408 CHECK_EQ(0, GetJsEntrySp()); |
| 408 CompileRun("js_entry_sp();"); | 409 CompileRun("js_entry_sp();"); |
| 409 CHECK_EQ(0, GetJsEntrySp()); | 410 CHECK_EQ(0, GetJsEntrySp()); |
| 410 CompileRun("js_entry_sp_level2();"); | 411 CompileRun("js_entry_sp_level2();"); |
| 411 CHECK_EQ(0, GetJsEntrySp()); | 412 CHECK_EQ(0, GetJsEntrySp()); |
| 412 } | 413 } |
| OLD | NEW |