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

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: ptal 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') | no next file » | 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 11174 matching lines...) Expand 10 before | Expand all | Expand 10 after
11185 11185
11186 11186
11187 static const int kFrameDetailsFrameIdIndex = 0; 11187 static const int kFrameDetailsFrameIdIndex = 0;
11188 static const int kFrameDetailsReceiverIndex = 1; 11188 static const int kFrameDetailsReceiverIndex = 1;
11189 static const int kFrameDetailsFunctionIndex = 2; 11189 static const int kFrameDetailsFunctionIndex = 2;
11190 static const int kFrameDetailsArgumentCountIndex = 3; 11190 static const int kFrameDetailsArgumentCountIndex = 3;
11191 static const int kFrameDetailsLocalCountIndex = 4; 11191 static const int kFrameDetailsLocalCountIndex = 4;
11192 static const int kFrameDetailsSourcePositionIndex = 5; 11192 static const int kFrameDetailsSourcePositionIndex = 5;
11193 static const int kFrameDetailsConstructCallIndex = 6; 11193 static const int kFrameDetailsConstructCallIndex = 6;
11194 static const int kFrameDetailsAtReturnIndex = 7; 11194 static const int kFrameDetailsAtReturnIndex = 7;
11195 static const int kFrameDetailsFlagsIndex = 8; 11195 static const int kFrameDetailsFramePointerHighIndex = 8;
11196 static const int kFrameDetailsFirstDynamicIndex = 9; 11196 static const int kFrameDetailsFramePointerLowIndex = 9;
11197 11197 static const int kFrameDetailsFlagsIndex = 10;
11198 static const int kFrameDetailsFirstDynamicIndex = 11;
11198 11199
11199 static SaveContext* FindSavedContextForFrame(Isolate* isolate, 11200 static SaveContext* FindSavedContextForFrame(Isolate* isolate,
11200 JavaScriptFrame* frame) { 11201 JavaScriptFrame* frame) {
11201 SaveContext* save = isolate->save_context(); 11202 SaveContext* save = isolate->save_context();
11202 while (save != NULL && !save->IsBelowFrame(frame)) { 11203 while (save != NULL && !save->IsBelowFrame(frame)) {
11203 save = save->prev(); 11204 save = save->prev();
11204 } 11205 }
11205 ASSERT(save != NULL); 11206 ASSERT(save != NULL);
11206 return save; 11207 return save;
11207 } 11208 }
11208 11209
11209 11210
11210 // Return an array with frame details 11211 // Return an array with frame details
11211 // args[0]: number: break id 11212 // args[0]: number: break id
11212 // args[1]: number: frame index 11213 // args[1]: number: frame index
11213 // 11214 //
11214 // The array returned contains the following information: 11215 // The array returned contains the following information:
11215 // 0: Frame id 11216 // 0: Frame id
11216 // 1: Receiver 11217 // 1: Receiver
11217 // 2: Function 11218 // 2: Function
11218 // 3: Argument count 11219 // 3: Argument count
11219 // 4: Local count 11220 // 4: Local count
11220 // 5: Source position 11221 // 5: Source position
11221 // 6: Constructor call 11222 // 6: Constructor call
11222 // 7: Is at return 11223 // 7: Is at return
11223 // 8: Flags 11224 // 8: Frame pointer high
11225 // 9: Frame pointer low
11226 // 10: Flags
11224 // Arguments name, value 11227 // Arguments name, value
11225 // Locals name, value 11228 // Locals name, value
11226 // Return value if any 11229 // Return value if any
11227 RUNTIME_FUNCTION(Runtime_GetFrameDetails) { 11230 RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
11228 HandleScope scope(isolate); 11231 HandleScope scope(isolate);
11229 ASSERT(args.length() == 2); 11232 ASSERT(args.length() == 2);
11230 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 11233 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
11231 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); 11234 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
11232 11235
11233 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 11236 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
11398 } else { 11401 } else {
11399 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value()); 11402 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value());
11400 } 11403 }
11401 11404
11402 // Add the constructor information. 11405 // Add the constructor information.
11403 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor)); 11406 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor));
11404 11407
11405 // Add the at return information. 11408 // Add the at return information.
11406 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return)); 11409 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return));
11407 11410
11411 uintptr_t frame_pointer =
11412 reinterpret_cast<uintptr_t>(it.frame()->UnpaddedFP());
11413
11414 details->set(kFrameDetailsFramePointerHighIndex,
11415 *isolate->factory()->NewNumberFromUint(
Vyacheslav Egorov (Google) 2014/09/10 22:34:25 this is GC unsafe in V8, you need to split it into
Jacob 2014/09/11 00:45:56 Done.
11416 static_cast<uint32_t>(frame_pointer >> 32)));
11417 details->set(kFrameDetailsFramePointerLowIndex,
11418 *isolate->factory()->NewNumberFromUint(
11419 static_cast<uint32_t>(frame_pointer & 0xffffffff)));
11420
11408 // Add flags to indicate information on whether this frame is 11421 // Add flags to indicate information on whether this frame is
11409 // bit 0: invoked in the debugger context. 11422 // bit 0: invoked in the debugger context.
11410 // bit 1: optimized frame. 11423 // bit 1: optimized frame.
11411 // bit 2: inlined in optimized frame 11424 // bit 2: inlined in optimized frame
11412 int flags = 0; 11425 int flags = 0;
11413 if (*save->context() == *isolate->debug()->debug_context()) { 11426 if (*save->context() == *isolate->debug()->debug_context()) {
11414 flags |= 1 << 0; 11427 flags |= 1 << 0;
11415 } 11428 }
11416 if (is_optimized) { 11429 if (is_optimized) {
11417 flags |= 1 << 1; 11430 flags |= 1 << 1;
(...skipping 3803 matching lines...) Expand 10 before | Expand all | Expand 10 after
15221 } 15234 }
15222 return NULL; 15235 return NULL;
15223 } 15236 }
15224 15237
15225 15238
15226 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15239 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15227 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15240 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15228 } 15241 }
15229 15242
15230 } } // namespace v8::internal 15243 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698