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

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: 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 kFrameDetailsFramePointerIndex = 8;
11196 static const int kFrameDetailsFirstDynamicIndex = 9; 11196 static const int kFrameDetailsFlagsIndex = 9;
11197 static const int kFrameDetailsFirstDynamicIndex = 10;
11197 11198
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
11225 // 9: Flags
11224 // Arguments name, value 11226 // Arguments name, value
11225 // Locals name, value 11227 // Locals name, value
11226 // Return value if any 11228 // Return value if any
11227 RUNTIME_FUNCTION(Runtime_GetFrameDetails) { 11229 RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
11228 HandleScope scope(isolate); 11230 HandleScope scope(isolate);
11229 ASSERT(args.length() == 2); 11231 ASSERT(args.length() == 2);
11230 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 11232 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
11231 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); 11233 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id));
11232 11234
11233 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 11235 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
11398 } else { 11400 } else {
11399 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value()); 11401 details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value());
11400 } 11402 }
11401 11403
11402 // Add the constructor information. 11404 // Add the constructor information.
11403 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor)); 11405 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(constructor));
11404 11406
11405 // Add the at return information. 11407 // Add the at return information.
11406 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return)); 11408 details->set(kFrameDetailsAtReturnIndex, heap->ToBoolean(at_return));
11407 11409
11410 // No memory address will actually be larger than 2^48 on a current x64
11411 // machine but we truncate to 53 bits to future proof this method. Users
11412 // should not care about the exact frame pointer values only the
11413 // order of frame pointers. Truncating to 53 bits will still generate the
11414 // correct ordering with very high probability.
11415 uintptr_t frame_pointer =
11416 reinterpret_cast<uintptr_t>(it.frame()->UnpaddedFP()) &
11417 ((static_cast<uintptr_t>(1)<<53) - 1);
hausner 2014/09/05 18:08:36 How about building the mask as a const uint64_t va
11418 details->set(kFrameDetailsFramePointerIndex,
11419 *isolate->factory()->NewNumber(static_cast<double>(frame_pointer)));
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