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

Side by Side Diff: src/runtime.cc

Issue 544143003: Store frame pointers (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.27
Patch Set: moved to v8 trunk, added a unittest, and fixed compile warning from mainline v8 build. Created 6 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « src/mirror-debugger.js ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 11208 matching lines...) Expand 10 before | Expand all | Expand 10 after
11219 11219
11220 11220
11221 static const int kFrameDetailsFrameIdIndex = 0; 11221 static const int kFrameDetailsFrameIdIndex = 0;
11222 static const int kFrameDetailsReceiverIndex = 1; 11222 static const int kFrameDetailsReceiverIndex = 1;
11223 static const int kFrameDetailsFunctionIndex = 2; 11223 static const int kFrameDetailsFunctionIndex = 2;
11224 static const int kFrameDetailsArgumentCountIndex = 3; 11224 static const int kFrameDetailsArgumentCountIndex = 3;
11225 static const int kFrameDetailsLocalCountIndex = 4; 11225 static const int kFrameDetailsLocalCountIndex = 4;
11226 static const int kFrameDetailsSourcePositionIndex = 5; 11226 static const int kFrameDetailsSourcePositionIndex = 5;
11227 static const int kFrameDetailsConstructCallIndex = 6; 11227 static const int kFrameDetailsConstructCallIndex = 6;
11228 static const int kFrameDetailsAtReturnIndex = 7; 11228 static const int kFrameDetailsAtReturnIndex = 7;
11229 static const int kFrameDetailsFlagsIndex = 8; 11229 static const int kFrameDetailsFramePointerHighIndex = 8;
11230 static const int kFrameDetailsFirstDynamicIndex = 9; 11230 static const int kFrameDetailsFramePointerLowIndex = 9;
11231 11231 static const int kFrameDetailsFlagsIndex = 10;
11232 static const int kFrameDetailsFirstDynamicIndex = 11;
11232 11233
11233 static SaveContext* FindSavedContextForFrame(Isolate* isolate, 11234 static SaveContext* FindSavedContextForFrame(Isolate* isolate,
11234 JavaScriptFrame* frame) { 11235 JavaScriptFrame* frame) {
11235 SaveContext* save = isolate->save_context(); 11236 SaveContext* save = isolate->save_context();
11236 while (save != NULL && !save->IsBelowFrame(frame)) { 11237 while (save != NULL && !save->IsBelowFrame(frame)) {
11237 save = save->prev(); 11238 save = save->prev();
11238 } 11239 }
11239 DCHECK(save != NULL); 11240 DCHECK(save != NULL);
11240 return save; 11241 return save;
11241 } 11242 }
(...skipping 22 matching lines...) Expand all
11264 // 11265 //
11265 // The array returned contains the following information: 11266 // The array returned contains the following information:
11266 // 0: Frame id 11267 // 0: Frame id
11267 // 1: Receiver 11268 // 1: Receiver
11268 // 2: Function 11269 // 2: Function
11269 // 3: Argument count 11270 // 3: Argument count
11270 // 4: Local count 11271 // 4: Local count
11271 // 5: Source position 11272 // 5: Source position
11272 // 6: Constructor call 11273 // 6: Constructor call
11273 // 7: Is at return 11274 // 7: Is at return
11274 // 8: Flags 11275 // 8: Frame pointer high
11276 // 9: Frame pointer low
11277 // 10: Flags
11275 // Arguments name, value 11278 // Arguments name, value
11276 // Locals name, value 11279 // Locals name, value
11277 // Return value if any 11280 // Return value if any
11278 RUNTIME_FUNCTION(Runtime_GetFrameDetails) { 11281 RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
11279 HandleScope scope(isolate); 11282 HandleScope scope(isolate);
11280 DCHECK(args.length() == 2); 11283 DCHECK(args.length() == 2);
11281 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 11284 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
11282 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); 11285 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
11283 11286
11284 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 11287 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
11441 } else { 11444 } else {
11442 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value()); 11445 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value());
11443 } 11446 }
11444 11447
11445 // Add the constructor information. 11448 // Add the constructor information.
11446 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor)); 11449 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor));
11447 11450
11448 // Add the at return information. 11451 // Add the at return information.
11449 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return)); 11452 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return));
11450 11453
11454 uintptr_t frame_pointer =
11455 reinterpret_cast<uintptr_t>(it.frame()->UnpaddedFP());
11456
11457 #ifdef V8_HOST_ARCH_64_BIT
11458 Handle<Object> frame_pointer_high = isolate->factory()->NewNumberFromUint(
11459 static_cast<uint32_t>(frame_pointer >> 32));
11460 details->set(kFrameDetailsFramePointerHighIndex, *frame_pointer_high);
11461 #else
11462 details->set(kFrameDetailsFramePointerHighIndex, Smi::FromInt(0));
11463 #endif
11464 Handle<Object> frame_pointer_low = isolate->factory()->NewNumberFromUint(
11465 static_cast<uint32_t>(frame_pointer & 0xffffffff));
11466 details->set(kFrameDetailsFramePointerLowIndex, *frame_pointer_low);
11467
11451 // Add flags to indicate information on whether this frame is 11468 // Add flags to indicate information on whether this frame is
11452 // bit 0: invoked in the debugger context. 11469 // bit 0: invoked in the debugger context.
11453 // bit 1: optimized frame. 11470 // bit 1: optimized frame.
11454 // bit 2: inlined in optimized frame 11471 // bit 2: inlined in optimized frame
11455 int flags = 0; 11472 int flags = 0;
11456 if (*save->context() == *isolate->debug()->debug_context()) { 11473 if (*save->context() == *isolate->debug()->debug_context()) {
11457 flags |= 1 << 0; 11474 flags |= 1 << 0;
11458 } 11475 }
11459 if (is_optimized) { 11476 if (is_optimized) {
11460 flags |= 1 << 1; 11477 flags |= 1 << 1;
(...skipping 4203 matching lines...) Expand 10 before | Expand all | Expand 10 after
15664 } 15681 }
15665 return NULL; 15682 return NULL;
15666 } 15683 }
15667 15684
15668 15685
15669 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15686 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15670 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15687 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15671 } 15688 }
15672 15689
15673 } } // namespace v8::internal 15690 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mirror-debugger.js ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698