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

Side by Side Diff: src/debug.cc

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 years, 6 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 obj.Dispose(); 676 obj.Dispose();
677 obj.Clear(); 677 obj.Clear();
678 } 678 }
679 679
680 680
681 void Debug::Setup(bool create_heap_objects) { 681 void Debug::Setup(bool create_heap_objects) {
682 ThreadInit(); 682 ThreadInit();
683 if (create_heap_objects) { 683 if (create_heap_objects) {
684 // Get code to handle debug break on return. 684 // Get code to handle debug break on return.
685 debug_break_return_ = 685 debug_break_return_ =
686 Builtins::builtin(Builtins::Return_DebugBreak); 686 Isolate::Current()->builtins()->builtin(Builtins::Return_DebugBreak);
687 ASSERT(debug_break_return_->IsCode()); 687 ASSERT(debug_break_return_->IsCode());
688 // Get code to handle debug break in debug break slots. 688 // Get code to handle debug break in debug break slots.
689 debug_break_slot_ = 689 debug_break_slot_ =
690 Builtins::builtin(Builtins::Slot_DebugBreak); 690 Isolate::Current()->builtins()->builtin(Builtins::Slot_DebugBreak);
691 ASSERT(debug_break_slot_->IsCode()); 691 ASSERT(debug_break_slot_->IsCode());
692 } 692 }
693 } 693 }
694 694
695 695
696 void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) { 696 void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
697 DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data); 697 DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data);
698 RemoveDebugInfo(node->debug_info()); 698 RemoveDebugInfo(node->debug_info());
699 #ifdef DEBUG 699 #ifdef DEBUG
700 node = Debug::debug_info_list_; 700 node = Debug::debug_info_list_;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 949
950 // Clear all current stepping setup. 950 // Clear all current stepping setup.
951 ClearStepping(); 951 ClearStepping();
952 952
953 // Set up for the remaining steps. 953 // Set up for the remaining steps.
954 PrepareStep(step_action, step_count); 954 PrepareStep(step_action, step_count);
955 } 955 }
956 956
957 if (thread_local_.frames_are_dropped_) { 957 if (thread_local_.frames_are_dropped_) {
958 // We must have been calling IC stub. Do not return there anymore. 958 // We must have been calling IC stub. Do not return there anymore.
959 Code* plain_return = Builtins::builtin(Builtins::PlainReturn_LiveEdit); 959 Code* plain_return =
960 Isolate::Current()->builtins()->builtin(Builtins::PlainReturn_LiveEdit);
960 thread_local_.after_break_target_ = plain_return->entry(); 961 thread_local_.after_break_target_ = plain_return->entry();
961 } else { 962 } else {
962 SetAfterBreakTarget(frame); 963 SetAfterBreakTarget(frame);
963 } 964 }
964 965
965 return HEAP->undefined_value(); 966 return HEAP->undefined_value();
966 } 967 }
967 968
968 969
969 // Check the break point objects for whether one or more are actually 970 // Check the break point objects for whether one or more are actually
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id()); 1016 Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id());
1016 1017
1017 // Call HandleBreakPointx. 1018 // Call HandleBreakPointx.
1018 bool caught_exception = false; 1019 bool caught_exception = false;
1019 const int argc = 2; 1020 const int argc = 2;
1020 Object** argv[argc] = { 1021 Object** argv[argc] = {
1021 break_id.location(), 1022 break_id.location(),
1022 reinterpret_cast<Object**>(break_point_object.location()) 1023 reinterpret_cast<Object**>(break_point_object.location())
1023 }; 1024 };
1024 Handle<Object> result = Execution::TryCall(check_break_point, 1025 Handle<Object> result = Execution::TryCall(check_break_point,
1025 Isolate::Current()->builtins(), 1026 Isolate::Current()->js_builtins_object(), argc, argv, &caught_exception);
1026 argc, argv, &caught_exception);
1027 1027
1028 // If exception or non boolean result handle as not triggered 1028 // If exception or non boolean result handle as not triggered
1029 if (caught_exception || !result->IsBoolean()) { 1029 if (caught_exception || !result->IsBoolean()) {
1030 return false; 1030 return false;
1031 } 1031 }
1032 1032
1033 // Return whether the break point is triggered. 1033 // Return whether the break point is triggered.
1034 return *result == HEAP->true_value(); 1034 return *result == HEAP->true_value();
1035 } 1035 }
1036 1036
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { 1419 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
1420 // Find the builtin debug break function matching the calling convention 1420 // Find the builtin debug break function matching the calling convention
1421 // used by the call site. 1421 // used by the call site.
1422 if (code->is_inline_cache_stub()) { 1422 if (code->is_inline_cache_stub()) {
1423 switch (code->kind()) { 1423 switch (code->kind()) {
1424 case Code::CALL_IC: 1424 case Code::CALL_IC:
1425 case Code::KEYED_CALL_IC: 1425 case Code::KEYED_CALL_IC:
1426 return ComputeCallDebugBreak(code->arguments_count(), code->kind()); 1426 return ComputeCallDebugBreak(code->arguments_count(), code->kind());
1427 1427
1428 case Code::LOAD_IC: 1428 case Code::LOAD_IC:
1429 return Handle<Code>(Builtins::builtin(Builtins::LoadIC_DebugBreak)); 1429 return Handle<Code>(Isolate::Current()->builtins()->builtin(
1430 Builtins::LoadIC_DebugBreak));
1430 1431
1431 case Code::STORE_IC: 1432 case Code::STORE_IC:
1432 return Handle<Code>(Builtins::builtin(Builtins::StoreIC_DebugBreak)); 1433 return Handle<Code>(Isolate::Current()->builtins()->builtin(
1434 Builtins::StoreIC_DebugBreak));
1433 1435
1434 case Code::KEYED_LOAD_IC: 1436 case Code::KEYED_LOAD_IC:
1435 return Handle<Code>( 1437 return Handle<Code>(
1436 Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak)); 1438 Isolate::Current()->builtins()->builtin(
1439 Builtins::KeyedLoadIC_DebugBreak));
1437 1440
1438 case Code::KEYED_STORE_IC: 1441 case Code::KEYED_STORE_IC:
1439 return Handle<Code>( 1442 return Handle<Code>(
1440 Builtins::builtin(Builtins::KeyedStoreIC_DebugBreak)); 1443 Isolate::Current()->builtins()->builtin(
1444 Builtins::KeyedStoreIC_DebugBreak));
1441 1445
1442 default: 1446 default:
1443 UNREACHABLE(); 1447 UNREACHABLE();
1444 } 1448 }
1445 } 1449 }
1446 if (RelocInfo::IsConstructCall(mode)) { 1450 if (RelocInfo::IsConstructCall(mode)) {
1447 Handle<Code> result = 1451 Handle<Code> result =
1448 Handle<Code>(Builtins::builtin(Builtins::ConstructCall_DebugBreak)); 1452 Handle<Code>(Isolate::Current()->builtins()->builtin(
1453 Builtins::ConstructCall_DebugBreak));
1449 return result; 1454 return result;
1450 } 1455 }
1451 if (code->kind() == Code::STUB) { 1456 if (code->kind() == Code::STUB) {
1452 ASSERT(code->major_key() == CodeStub::CallFunction || 1457 ASSERT(code->major_key() == CodeStub::CallFunction ||
1453 code->major_key() == CodeStub::StackCheck); 1458 code->major_key() == CodeStub::StackCheck);
1454 Handle<Code> result = 1459 Handle<Code> result =
1455 Handle<Code>(Builtins::builtin(Builtins::StubNoRegisters_DebugBreak)); 1460 Handle<Code>(Isolate::Current()->builtins()->builtin(
1461 Builtins::StubNoRegisters_DebugBreak));
1456 return result; 1462 return result;
1457 } 1463 }
1458 1464
1459 UNREACHABLE(); 1465 UNREACHABLE();
1460 return Handle<Code>::null(); 1466 return Handle<Code>::null();
1461 } 1467 }
1462 1468
1463 1469
1464 // Simple function for returning the source positions for active break points. 1470 // Simple function for returning the source positions for active break points.
1465 Handle<Object> Debug::GetSourceBreakLocations( 1471 Handle<Object> Debug::GetSourceBreakLocations(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 } 1519 }
1514 fp = it.frame()->fp(); 1520 fp = it.frame()->fp();
1515 } 1521 }
1516 1522
1517 // Flood the function with one-shot break points if it is called from where 1523 // Flood the function with one-shot break points if it is called from where
1518 // step into was requested. 1524 // step into was requested.
1519 if (fp == Debug::step_in_fp()) { 1525 if (fp == Debug::step_in_fp()) {
1520 // Don't allow step into functions in the native context. 1526 // Don't allow step into functions in the native context.
1521 if (!function->IsBuiltin()) { 1527 if (!function->IsBuiltin()) {
1522 if (function->shared()->code() == 1528 if (function->shared()->code() ==
1523 Builtins::builtin(Builtins::FunctionApply) || 1529 Isolate::Current()->builtins()->builtin(Builtins::FunctionApply) ||
1524 function->shared()->code() == 1530 function->shared()->code() ==
1525 Builtins::builtin(Builtins::FunctionCall)) { 1531 Isolate::Current()->builtins()->builtin(Builtins::FunctionCall)) {
1526 // Handle function.apply and function.call separately to flood the 1532 // Handle function.apply and function.call separately to flood the
1527 // function to be called and not the code for Builtins::FunctionApply or 1533 // function to be called and not the code for Builtins::FunctionApply or
1528 // Builtins::FunctionCall. The receiver of call/apply is the target 1534 // Builtins::FunctionCall. The receiver of call/apply is the target
1529 // function. 1535 // function.
1530 if (!holder.is_null() && holder->IsJSFunction() && 1536 if (!holder.is_null() && holder->IsJSFunction() &&
1531 !JSFunction::cast(*holder)->IsBuiltin()) { 1537 !JSFunction::cast(*holder)->IsBuiltin()) {
1532 Handle<SharedFunctionInfo> shared_info( 1538 Handle<SharedFunctionInfo> shared_info(
1533 JSFunction::cast(*holder)->shared()); 1539 JSFunction::cast(*holder)->shared());
1534 Debug::FloodWithOneShot(shared_info); 1540 Debug::FloodWithOneShot(shared_info);
1535 } 1541 }
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 // Wrap the script object in a proper JS object before passing it 2159 // Wrap the script object in a proper JS object before passing it
2154 // to JavaScript. 2160 // to JavaScript.
2155 Handle<JSValue> wrapper = GetScriptWrapper(script); 2161 Handle<JSValue> wrapper = GetScriptWrapper(script);
2156 2162
2157 // Call UpdateScriptBreakPoints expect no exceptions. 2163 // Call UpdateScriptBreakPoints expect no exceptions.
2158 bool caught_exception = false; 2164 bool caught_exception = false;
2159 const int argc = 1; 2165 const int argc = 1;
2160 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) }; 2166 Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
2161 Handle<Object> result = Execution::TryCall( 2167 Handle<Object> result = Execution::TryCall(
2162 Handle<JSFunction>::cast(update_script_break_points), 2168 Handle<JSFunction>::cast(update_script_break_points),
2163 Isolate::Current()->builtins(), argc, argv, 2169 Isolate::Current()->js_builtins_object(), argc, argv,
2164 &caught_exception); 2170 &caught_exception);
2165 if (caught_exception) { 2171 if (caught_exception) {
2166 return; 2172 return;
2167 } 2173 }
2168 // Bail out based on state or if there is no listener for this event 2174 // Bail out based on state or if there is no listener for this event
2169 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; 2175 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return;
2170 if (!Debugger::EventActive(v8::AfterCompile)) return; 2176 if (!Debugger::EventActive(v8::AfterCompile)) return;
2171 2177
2172 // Create the compile state object. 2178 // Create the compile state object.
2173 Handle<Object> event_data = MakeCompileEvent(script, 2179 Handle<Object> event_data = MakeCompileEvent(script,
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 { 2996 {
2991 Locker locker; 2997 Locker locker;
2992 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 2998 Isolate::Current()->debugger()->CallMessageDispatchHandler();
2993 } 2999 }
2994 } 3000 }
2995 } 3001 }
2996 3002
2997 #endif // ENABLE_DEBUGGER_SUPPORT 3003 #endif // ENABLE_DEBUGGER_SUPPORT
2998 3004
2999 } } // namespace v8::internal 3005 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/disassembler.cc » ('j') | src/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698