OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 new_map->set_prototype(proto); | 674 new_map->set_prototype(proto); |
675 jsobject->set_map(new_map); | 675 jsobject->set_map(new_map); |
676 | 676 |
677 return isolate->heap()->undefined_value(); | 677 return isolate->heap()->undefined_value(); |
678 } | 678 } |
679 | 679 |
680 | 680 |
681 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConstructCall) { | 681 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConstructCall) { |
682 NoHandleAllocation ha; | 682 NoHandleAllocation ha; |
683 ASSERT(args.length() == 0); | 683 ASSERT(args.length() == 0); |
684 JavaScriptFrameIterator it; | 684 JavaScriptFrameIterator it(isolate); |
685 return isolate->heap()->ToBoolean(it.frame()->IsConstructor()); | 685 return isolate->heap()->ToBoolean(it.frame()->IsConstructor()); |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 // Recursively traverses hidden prototypes if property is not found | 689 // Recursively traverses hidden prototypes if property is not found |
690 static void GetOwnPropertyImplementation(JSObject* obj, | 690 static void GetOwnPropertyImplementation(JSObject* obj, |
691 String* name, | 691 String* name, |
692 LookupResult* result) { | 692 LookupResult* result) { |
693 obj->LocalLookupRealNamedProperty(name, result); | 693 obj->LocalLookupRealNamedProperty(name, result); |
694 | 694 |
(...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4477 } | 4477 } |
4478 return *isolate->factory()->NewJSArrayWithElements(copy); | 4478 return *isolate->factory()->NewJSArrayWithElements(copy); |
4479 } | 4479 } |
4480 | 4480 |
4481 | 4481 |
4482 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) { | 4482 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) { |
4483 NoHandleAllocation ha; | 4483 NoHandleAllocation ha; |
4484 ASSERT(args.length() == 1); | 4484 ASSERT(args.length() == 1); |
4485 | 4485 |
4486 // Compute the frame holding the arguments. | 4486 // Compute the frame holding the arguments. |
4487 JavaScriptFrameIterator it; | 4487 JavaScriptFrameIterator it(isolate); |
4488 it.AdvanceToArgumentsFrame(); | 4488 it.AdvanceToArgumentsFrame(); |
4489 JavaScriptFrame* frame = it.frame(); | 4489 JavaScriptFrame* frame = it.frame(); |
4490 | 4490 |
4491 // Get the actual number of provided arguments. | 4491 // Get the actual number of provided arguments. |
4492 const uint32_t n = frame->ComputeParametersCount(); | 4492 const uint32_t n = frame->ComputeParametersCount(); |
4493 | 4493 |
4494 // Try to convert the key to an index. If successful and within | 4494 // Try to convert the key to an index. If successful and within |
4495 // index return the the argument from the frame. | 4495 // index return the the argument from the frame. |
4496 uint32_t index; | 4496 uint32_t index; |
4497 if (args[0]->ToArrayIndex(&index) && index < n) { | 4497 if (args[0]->ToArrayIndex(&index) && index < n) { |
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7316 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { | 7316 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
7317 HandleScope scope(isolate); | 7317 HandleScope scope(isolate); |
7318 ASSERT(args.length() == 1); | 7318 ASSERT(args.length() == 1); |
7319 RUNTIME_ASSERT(args[0]->IsSmi()); | 7319 RUNTIME_ASSERT(args[0]->IsSmi()); |
7320 Deoptimizer::BailoutType type = | 7320 Deoptimizer::BailoutType type = |
7321 static_cast<Deoptimizer::BailoutType>(Smi::cast(args[0])->value()); | 7321 static_cast<Deoptimizer::BailoutType>(Smi::cast(args[0])->value()); |
7322 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 7322 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
7323 ASSERT(isolate->heap()->IsAllocationAllowed()); | 7323 ASSERT(isolate->heap()->IsAllocationAllowed()); |
7324 int frames = deoptimizer->output_count(); | 7324 int frames = deoptimizer->output_count(); |
7325 | 7325 |
7326 JavaScriptFrameIterator it; | 7326 JavaScriptFrameIterator it(isolate); |
7327 JavaScriptFrame* frame = NULL; | 7327 JavaScriptFrame* frame = NULL; |
7328 for (int i = 0; i < frames; i++) { | 7328 for (int i = 0; i < frames; i++) { |
7329 if (i != 0) it.Advance(); | 7329 if (i != 0) it.Advance(); |
7330 frame = it.frame(); | 7330 frame = it.frame(); |
7331 deoptimizer->InsertHeapNumberValues(frames - i - 1, frame); | 7331 deoptimizer->InsertHeapNumberValues(frames - i - 1, frame); |
7332 } | 7332 } |
7333 delete deoptimizer; | 7333 delete deoptimizer; |
7334 | 7334 |
7335 RUNTIME_ASSERT(frame->function()->IsJSFunction()); | 7335 RUNTIME_ASSERT(frame->function()->IsJSFunction()); |
7336 Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate); | 7336 Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7418 // selected for on-stack replacement. Find the unoptimized code object. | 7418 // selected for on-stack replacement. Find the unoptimized code object. |
7419 Handle<Code> unoptimized(function->shared()->code(), isolate); | 7419 Handle<Code> unoptimized(function->shared()->code(), isolate); |
7420 // Keep track of whether we've succeeded in optimizing. | 7420 // Keep track of whether we've succeeded in optimizing. |
7421 bool succeeded = unoptimized->optimizable(); | 7421 bool succeeded = unoptimized->optimizable(); |
7422 if (succeeded) { | 7422 if (succeeded) { |
7423 // If we are trying to do OSR when there are already optimized | 7423 // If we are trying to do OSR when there are already optimized |
7424 // activations of the function, it means (a) the function is directly or | 7424 // activations of the function, it means (a) the function is directly or |
7425 // indirectly recursive and (b) an optimized invocation has been | 7425 // indirectly recursive and (b) an optimized invocation has been |
7426 // deoptimized so that we are currently in an unoptimized activation. | 7426 // deoptimized so that we are currently in an unoptimized activation. |
7427 // Check for optimized activations of this function. | 7427 // Check for optimized activations of this function. |
7428 JavaScriptFrameIterator it; | 7428 JavaScriptFrameIterator it(isolate); |
7429 while (succeeded && !it.done()) { | 7429 while (succeeded && !it.done()) { |
7430 JavaScriptFrame* frame = it.frame(); | 7430 JavaScriptFrame* frame = it.frame(); |
7431 succeeded = !frame->is_optimized() || frame->function() != *function; | 7431 succeeded = !frame->is_optimized() || frame->function() != *function; |
7432 it.Advance(); | 7432 it.Advance(); |
7433 } | 7433 } |
7434 } | 7434 } |
7435 | 7435 |
7436 int ast_id = AstNode::kNoNumber; | 7436 int ast_id = AstNode::kNoNumber; |
7437 if (succeeded) { | 7437 if (succeeded) { |
7438 // The top JS function is this one, the PC is somewhere in the | 7438 // The top JS function is this one, the PC is somewhere in the |
7439 // unoptimized code. | 7439 // unoptimized code. |
7440 JavaScriptFrameIterator it; | 7440 JavaScriptFrameIterator it(isolate); |
7441 JavaScriptFrame* frame = it.frame(); | 7441 JavaScriptFrame* frame = it.frame(); |
7442 ASSERT(frame->function() == *function); | 7442 ASSERT(frame->function() == *function); |
7443 ASSERT(frame->LookupCode(isolate) == *unoptimized); | 7443 ASSERT(frame->LookupCode() == *unoptimized); |
7444 ASSERT(unoptimized->contains(frame->pc())); | 7444 ASSERT(unoptimized->contains(frame->pc())); |
7445 | 7445 |
7446 // Use linear search of the unoptimized code's stack check table to find | 7446 // Use linear search of the unoptimized code's stack check table to find |
7447 // the AST id matching the PC. | 7447 // the AST id matching the PC. |
7448 Address start = unoptimized->instruction_start(); | 7448 Address start = unoptimized->instruction_start(); |
7449 unsigned target_pc_offset = static_cast<unsigned>(frame->pc() - start); | 7449 unsigned target_pc_offset = static_cast<unsigned>(frame->pc() - start); |
7450 Address table_cursor = start + unoptimized->stack_check_table_offset(); | 7450 Address table_cursor = start + unoptimized->stack_check_table_offset(); |
7451 uint32_t table_length = Memory::uint32_at(table_cursor); | 7451 uint32_t table_length = Memory::uint32_at(table_cursor); |
7452 table_cursor += kIntSize; | 7452 table_cursor += kIntSize; |
7453 for (unsigned i = 0; i < table_length; ++i) { | 7453 for (unsigned i = 0; i < table_length; ++i) { |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7994 | 7994 |
7995 | 7995 |
7996 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrint) { | 7996 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrint) { |
7997 NoHandleAllocation ha; | 7997 NoHandleAllocation ha; |
7998 ASSERT(args.length() == 1); | 7998 ASSERT(args.length() == 1); |
7999 | 7999 |
8000 #ifdef DEBUG | 8000 #ifdef DEBUG |
8001 if (args[0]->IsString()) { | 8001 if (args[0]->IsString()) { |
8002 // If we have a string, assume it's a code "marker" | 8002 // If we have a string, assume it's a code "marker" |
8003 // and print some interesting cpu debugging info. | 8003 // and print some interesting cpu debugging info. |
8004 JavaScriptFrameIterator it; | 8004 JavaScriptFrameIterator it(isolate); |
8005 JavaScriptFrame* frame = it.frame(); | 8005 JavaScriptFrame* frame = it.frame(); |
8006 PrintF("fp = %p, sp = %p, caller_sp = %p: ", | 8006 PrintF("fp = %p, sp = %p, caller_sp = %p: ", |
8007 frame->fp(), frame->sp(), frame->caller_sp()); | 8007 frame->fp(), frame->sp(), frame->caller_sp()); |
8008 } else { | 8008 } else { |
8009 PrintF("DebugPrint: "); | 8009 PrintF("DebugPrint: "); |
8010 } | 8010 } |
8011 args[0]->Print(); | 8011 args[0]->Print(); |
8012 if (args[0]->IsHeapObject()) { | 8012 if (args[0]->IsHeapObject()) { |
8013 PrintF("\n"); | 8013 PrintF("\n"); |
8014 HeapObject::cast(args[0])->map()->Print(); | 8014 HeapObject::cast(args[0])->map()->Print(); |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9330 if (!maybe_result->ToObject(&result)) return maybe_result; | 9330 if (!maybe_result->ToObject(&result)) return maybe_result; |
9331 } | 9331 } |
9332 | 9332 |
9333 // Count all frames which are relevant to debugging stack trace. | 9333 // Count all frames which are relevant to debugging stack trace. |
9334 int n = 0; | 9334 int n = 0; |
9335 StackFrame::Id id = isolate->debug()->break_frame_id(); | 9335 StackFrame::Id id = isolate->debug()->break_frame_id(); |
9336 if (id == StackFrame::NO_ID) { | 9336 if (id == StackFrame::NO_ID) { |
9337 // If there is no JavaScript stack frame count is 0. | 9337 // If there is no JavaScript stack frame count is 0. |
9338 return Smi::FromInt(0); | 9338 return Smi::FromInt(0); |
9339 } | 9339 } |
9340 for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) n++; | 9340 for (JavaScriptFrameIterator it(isolate, id); !it.done(); it.Advance()) n++; |
9341 return Smi::FromInt(n); | 9341 return Smi::FromInt(n); |
9342 } | 9342 } |
9343 | 9343 |
9344 | 9344 |
9345 static const int kFrameDetailsFrameIdIndex = 0; | 9345 static const int kFrameDetailsFrameIdIndex = 0; |
9346 static const int kFrameDetailsReceiverIndex = 1; | 9346 static const int kFrameDetailsReceiverIndex = 1; |
9347 static const int kFrameDetailsFunctionIndex = 2; | 9347 static const int kFrameDetailsFunctionIndex = 2; |
9348 static const int kFrameDetailsArgumentCountIndex = 3; | 9348 static const int kFrameDetailsArgumentCountIndex = 3; |
9349 static const int kFrameDetailsLocalCountIndex = 4; | 9349 static const int kFrameDetailsLocalCountIndex = 4; |
9350 static const int kFrameDetailsSourcePositionIndex = 5; | 9350 static const int kFrameDetailsSourcePositionIndex = 5; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9383 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); | 9383 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
9384 Heap* heap = isolate->heap(); | 9384 Heap* heap = isolate->heap(); |
9385 | 9385 |
9386 // Find the relevant frame with the requested index. | 9386 // Find the relevant frame with the requested index. |
9387 StackFrame::Id id = isolate->debug()->break_frame_id(); | 9387 StackFrame::Id id = isolate->debug()->break_frame_id(); |
9388 if (id == StackFrame::NO_ID) { | 9388 if (id == StackFrame::NO_ID) { |
9389 // If there are no JavaScript stack frames return undefined. | 9389 // If there are no JavaScript stack frames return undefined. |
9390 return heap->undefined_value(); | 9390 return heap->undefined_value(); |
9391 } | 9391 } |
9392 int count = 0; | 9392 int count = 0; |
9393 JavaScriptFrameIterator it(id); | 9393 JavaScriptFrameIterator it(isolate, id); |
9394 for (; !it.done(); it.Advance()) { | 9394 for (; !it.done(); it.Advance()) { |
9395 if (count == index) break; | 9395 if (count == index) break; |
9396 count++; | 9396 count++; |
9397 } | 9397 } |
9398 if (it.done()) return heap->undefined_value(); | 9398 if (it.done()) return heap->undefined_value(); |
9399 | 9399 |
9400 bool is_optimized_frame = | 9400 bool is_optimized_frame = |
9401 it.frame()->LookupCode(isolate)->kind() == Code::OPTIMIZED_FUNCTION; | 9401 it.frame()->LookupCode()->kind() == Code::OPTIMIZED_FUNCTION; |
9402 | 9402 |
9403 // Traverse the saved contexts chain to find the active context for the | 9403 // Traverse the saved contexts chain to find the active context for the |
9404 // selected frame. | 9404 // selected frame. |
9405 SaveContext* save = isolate->save_context(); | 9405 SaveContext* save = isolate->save_context(); |
9406 while (save != NULL && !save->below(it.frame())) { | 9406 while (save != NULL && !save->below(it.frame())) { |
9407 save = save->prev(); | 9407 save = save->prev(); |
9408 } | 9408 } |
9409 ASSERT(save != NULL); | 9409 ASSERT(save != NULL); |
9410 | 9410 |
9411 // Get the frame id. | 9411 // Get the frame id. |
9412 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); | 9412 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); |
9413 | 9413 |
9414 // Find source position. | 9414 // Find source position. |
9415 int position = | 9415 int position = |
9416 it.frame()->LookupCode(isolate)->SourcePosition(it.frame()->pc()); | 9416 it.frame()->LookupCode()->SourcePosition(it.frame()->pc()); |
9417 | 9417 |
9418 // Check for constructor frame. | 9418 // Check for constructor frame. |
9419 bool constructor = it.frame()->IsConstructor(); | 9419 bool constructor = it.frame()->IsConstructor(); |
9420 | 9420 |
9421 // Get scope info and read from it for local variable information. | 9421 // Get scope info and read from it for local variable information. |
9422 Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); | 9422 Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); |
9423 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); | 9423 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); |
9424 ScopeInfo<> info(*scope_info); | 9424 ScopeInfo<> info(*scope_info); |
9425 | 9425 |
9426 // Get the context. | 9426 // Get the context. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9468 // frame or if the frame is optimized it cannot be at a return. | 9468 // frame or if the frame is optimized it cannot be at a return. |
9469 bool at_return = false; | 9469 bool at_return = false; |
9470 if (!is_optimized_frame && index == 0) { | 9470 if (!is_optimized_frame && index == 0) { |
9471 at_return = isolate->debug()->IsBreakAtReturn(it.frame()); | 9471 at_return = isolate->debug()->IsBreakAtReturn(it.frame()); |
9472 } | 9472 } |
9473 | 9473 |
9474 // If positioned just before return find the value to be returned and add it | 9474 // If positioned just before return find the value to be returned and add it |
9475 // to the frame information. | 9475 // to the frame information. |
9476 Handle<Object> return_value = isolate->factory()->undefined_value(); | 9476 Handle<Object> return_value = isolate->factory()->undefined_value(); |
9477 if (at_return) { | 9477 if (at_return) { |
9478 StackFrameIterator it2; | 9478 StackFrameIterator it2(isolate); |
9479 Address internal_frame_sp = NULL; | 9479 Address internal_frame_sp = NULL; |
9480 while (!it2.done()) { | 9480 while (!it2.done()) { |
9481 if (it2.frame()->is_internal()) { | 9481 if (it2.frame()->is_internal()) { |
9482 internal_frame_sp = it2.frame()->sp(); | 9482 internal_frame_sp = it2.frame()->sp(); |
9483 } else { | 9483 } else { |
9484 if (it2.frame()->is_java_script()) { | 9484 if (it2.frame()->is_java_script()) { |
9485 if (it2.frame()->id() == it.frame()->id()) { | 9485 if (it2.frame()->id() == it.frame()->id()) { |
9486 // The internal frame just before the JavaScript frame contains the | 9486 // The internal frame just before the JavaScript frame contains the |
9487 // value to return on top. A debug break at return will create an | 9487 // value to return on top. A debug break at return will create an |
9488 // internal frame to store the return value (eax/rax/r0) before | 9488 // internal frame to store the return value (eax/rax/r0) before |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10001 // Check arguments. | 10001 // Check arguments. |
10002 Object* check; | 10002 Object* check; |
10003 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | 10003 { MaybeObject* maybe_check = Runtime_CheckExecutionState( |
10004 RUNTIME_ARGUMENTS(isolate, args)); | 10004 RUNTIME_ARGUMENTS(isolate, args)); |
10005 if (!maybe_check->ToObject(&check)) return maybe_check; | 10005 if (!maybe_check->ToObject(&check)) return maybe_check; |
10006 } | 10006 } |
10007 CONVERT_CHECKED(Smi, wrapped_id, args[1]); | 10007 CONVERT_CHECKED(Smi, wrapped_id, args[1]); |
10008 | 10008 |
10009 // Get the frame where the debugging is performed. | 10009 // Get the frame where the debugging is performed. |
10010 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 10010 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
10011 JavaScriptFrameIterator it(id); | 10011 JavaScriptFrameIterator it(isolate, id); |
10012 JavaScriptFrame* frame = it.frame(); | 10012 JavaScriptFrame* frame = it.frame(); |
10013 | 10013 |
10014 // Count the visible scopes. | 10014 // Count the visible scopes. |
10015 int n = 0; | 10015 int n = 0; |
10016 for (ScopeIterator it(isolate, frame); !it.Done(); it.Next()) { | 10016 for (ScopeIterator it(isolate, frame); !it.Done(); it.Next()) { |
10017 n++; | 10017 n++; |
10018 } | 10018 } |
10019 | 10019 |
10020 return Smi::FromInt(n); | 10020 return Smi::FromInt(n); |
10021 } | 10021 } |
(...skipping 19 matching lines...) Expand all Loading... |
10041 Object* check; | 10041 Object* check; |
10042 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | 10042 { MaybeObject* maybe_check = Runtime_CheckExecutionState( |
10043 RUNTIME_ARGUMENTS(isolate, args)); | 10043 RUNTIME_ARGUMENTS(isolate, args)); |
10044 if (!maybe_check->ToObject(&check)) return maybe_check; | 10044 if (!maybe_check->ToObject(&check)) return maybe_check; |
10045 } | 10045 } |
10046 CONVERT_CHECKED(Smi, wrapped_id, args[1]); | 10046 CONVERT_CHECKED(Smi, wrapped_id, args[1]); |
10047 CONVERT_NUMBER_CHECKED(int, index, Int32, args[2]); | 10047 CONVERT_NUMBER_CHECKED(int, index, Int32, args[2]); |
10048 | 10048 |
10049 // Get the frame where the debugging is performed. | 10049 // Get the frame where the debugging is performed. |
10050 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 10050 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
10051 JavaScriptFrameIterator frame_it(id); | 10051 JavaScriptFrameIterator frame_it(isolate, id); |
10052 JavaScriptFrame* frame = frame_it.frame(); | 10052 JavaScriptFrame* frame = frame_it.frame(); |
10053 | 10053 |
10054 // Find the requested scope. | 10054 // Find the requested scope. |
10055 int n = 0; | 10055 int n = 0; |
10056 ScopeIterator it(isolate, frame); | 10056 ScopeIterator it(isolate, frame); |
10057 for (; !it.Done() && n < index; it.Next()) { | 10057 for (; !it.Done() && n < index; it.Next()) { |
10058 n++; | 10058 n++; |
10059 } | 10059 } |
10060 if (it.Done()) { | 10060 if (it.Done()) { |
10061 return isolate->heap()->undefined_value(); | 10061 return isolate->heap()->undefined_value(); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10529 CONVERT_CHECKED(Smi, wrapped_id, args[1]); | 10529 CONVERT_CHECKED(Smi, wrapped_id, args[1]); |
10530 CONVERT_ARG_CHECKED(String, source, 2); | 10530 CONVERT_ARG_CHECKED(String, source, 2); |
10531 CONVERT_BOOLEAN_CHECKED(disable_break, args[3]); | 10531 CONVERT_BOOLEAN_CHECKED(disable_break, args[3]); |
10532 Handle<Object> additional_context(args[4]); | 10532 Handle<Object> additional_context(args[4]); |
10533 | 10533 |
10534 // Handle the processing of break. | 10534 // Handle the processing of break. |
10535 DisableBreak disable_break_save(disable_break); | 10535 DisableBreak disable_break_save(disable_break); |
10536 | 10536 |
10537 // Get the frame where the debugging is performed. | 10537 // Get the frame where the debugging is performed. |
10538 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 10538 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
10539 JavaScriptFrameIterator it(id); | 10539 JavaScriptFrameIterator it(isolate, id); |
10540 JavaScriptFrame* frame = it.frame(); | 10540 JavaScriptFrame* frame = it.frame(); |
10541 Handle<JSFunction> function(JSFunction::cast(frame->function())); | 10541 Handle<JSFunction> function(JSFunction::cast(frame->function())); |
10542 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); | 10542 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); |
10543 ScopeInfo<> sinfo(*scope_info); | 10543 ScopeInfo<> sinfo(*scope_info); |
10544 | 10544 |
10545 // Traverse the saved contexts chain to find the active context for the | 10545 // Traverse the saved contexts chain to find the active context for the |
10546 // selected frame. | 10546 // selected frame. |
10547 SaveContext* save = isolate->save_context(); | 10547 SaveContext* save = isolate->save_context(); |
10548 while (save != NULL && !save->below(frame)) { | 10548 while (save != NULL && !save->below(frame)) { |
10549 save = save->prev(); | 10549 save = save->prev(); |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11597 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[1]); | 11597 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[1]); |
11598 | 11598 |
11599 HandleScope scope(isolate); | 11599 HandleScope scope(isolate); |
11600 Factory* factory = isolate->factory(); | 11600 Factory* factory = isolate->factory(); |
11601 | 11601 |
11602 limit = Max(limit, 0); // Ensure that limit is not negative. | 11602 limit = Max(limit, 0); // Ensure that limit is not negative. |
11603 int initial_size = Min(limit, 10); | 11603 int initial_size = Min(limit, 10); |
11604 Handle<FixedArray> elements = | 11604 Handle<FixedArray> elements = |
11605 factory->NewFixedArrayWithHoles(initial_size * 4); | 11605 factory->NewFixedArrayWithHoles(initial_size * 4); |
11606 | 11606 |
11607 StackFrameIterator iter; | 11607 StackFrameIterator iter(isolate); |
11608 // If the caller parameter is a function we skip frames until we're | 11608 // If the caller parameter is a function we skip frames until we're |
11609 // under it before starting to collect. | 11609 // under it before starting to collect. |
11610 bool seen_caller = !caller->IsJSFunction(); | 11610 bool seen_caller = !caller->IsJSFunction(); |
11611 int cursor = 0; | 11611 int cursor = 0; |
11612 int frames_seen = 0; | 11612 int frames_seen = 0; |
11613 while (!iter.done() && frames_seen < limit) { | 11613 while (!iter.done() && frames_seen < limit) { |
11614 StackFrame* raw_frame = iter.frame(); | 11614 StackFrame* raw_frame = iter.frame(); |
11615 if (ShowFrameInStackTrace(raw_frame, *caller, &seen_caller)) { | 11615 if (ShowFrameInStackTrace(raw_frame, *caller, &seen_caller)) { |
11616 frames_seen++; | 11616 frames_seen++; |
11617 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); | 11617 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11938 } else { | 11938 } else { |
11939 // Handle last resort GC and make sure to allow future allocations | 11939 // Handle last resort GC and make sure to allow future allocations |
11940 // to grow the heap without causing GCs (if possible). | 11940 // to grow the heap without causing GCs (if possible). |
11941 isolate->counters()->gc_last_resort_from_js()->Increment(); | 11941 isolate->counters()->gc_last_resort_from_js()->Increment(); |
11942 isolate->heap()->CollectAllGarbage(false); | 11942 isolate->heap()->CollectAllGarbage(false); |
11943 } | 11943 } |
11944 } | 11944 } |
11945 | 11945 |
11946 | 11946 |
11947 } } // namespace v8::internal | 11947 } } // namespace v8::internal |
OLD | NEW |