OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 | 136 |
137 // Helper class for creating a V8 enviromnent for running tests | 137 // Helper class for creating a V8 enviromnent for running tests |
138 class DebugLocalContext { | 138 class DebugLocalContext { |
139 public: | 139 public: |
140 inline DebugLocalContext( | 140 inline DebugLocalContext( |
141 v8::ExtensionConfiguration* extensions = 0, | 141 v8::ExtensionConfiguration* extensions = 0, |
142 v8::Handle<v8::ObjectTemplate> global_template = | 142 v8::Handle<v8::ObjectTemplate> global_template = |
143 v8::Handle<v8::ObjectTemplate>(), | 143 v8::Handle<v8::ObjectTemplate>(), |
144 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) | 144 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) |
145 : scope_(v8::Isolate::GetCurrent()), | 145 : scope_(CcTest::isolate()), |
146 context_( | 146 context_( |
147 v8::Context::New(v8::Isolate::GetCurrent(), | 147 v8::Context::New(CcTest::isolate(), |
148 extensions, | 148 extensions, |
149 global_template, | 149 global_template, |
150 global_object)) { | 150 global_object)) { |
151 context_->Enter(); | 151 context_->Enter(); |
152 } | 152 } |
153 inline ~DebugLocalContext() { | 153 inline ~DebugLocalContext() { |
154 context_->Exit(); | 154 context_->Exit(); |
155 } | 155 } |
156 inline v8::Local<v8::Context> context() { return context_; } | 156 inline v8::Local<v8::Context> context() { return context_; } |
157 inline v8::Context* operator->() { return *context_; } | 157 inline v8::Context* operator->() { return *context_; } |
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 CheckDebuggerUnloaded(); | 2545 CheckDebuggerUnloaded(); |
2546 } | 2546 } |
2547 | 2547 |
2548 | 2548 |
2549 bool checkedDebugEvals = true; | 2549 bool checkedDebugEvals = true; |
2550 v8::Handle<v8::Function> checkGlobalEvalFunction; | 2550 v8::Handle<v8::Function> checkGlobalEvalFunction; |
2551 v8::Handle<v8::Function> checkFrameEvalFunction; | 2551 v8::Handle<v8::Function> checkFrameEvalFunction; |
2552 static void CheckDebugEval(const v8::Debug::EventDetails& eventDetails) { | 2552 static void CheckDebugEval(const v8::Debug::EventDetails& eventDetails) { |
2553 if (eventDetails.GetEvent() == v8::Break) { | 2553 if (eventDetails.GetEvent() == v8::Break) { |
2554 ++debugEventCount; | 2554 ++debugEventCount; |
2555 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); | 2555 v8::HandleScope handleScope(CcTest::isolate()); |
2556 | 2556 |
2557 v8::Handle<v8::Value> args[] = { eventDetails.GetExecutionState() }; | 2557 v8::Handle<v8::Value> args[] = { eventDetails.GetExecutionState() }; |
2558 CHECK(checkGlobalEvalFunction->Call( | 2558 CHECK(checkGlobalEvalFunction->Call( |
2559 eventDetails.GetEventContext()->Global(), 1, args)->IsTrue()); | 2559 eventDetails.GetEventContext()->Global(), 1, args)->IsTrue()); |
2560 CHECK(checkFrameEvalFunction->Call( | 2560 CHECK(checkFrameEvalFunction->Call( |
2561 eventDetails.GetEventContext()->Global(), 1, args)->IsTrue()); | 2561 eventDetails.GetEventContext()->Global(), 1, args)->IsTrue()); |
2562 } | 2562 } |
2563 } | 2563 } |
2564 | 2564 |
2565 | 2565 |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4222 } | 4222 } |
4223 | 4223 |
4224 static const char* kSimpleExtensionSource = | 4224 static const char* kSimpleExtensionSource = |
4225 "(function Foo() {" | 4225 "(function Foo() {" |
4226 " return 4;" | 4226 " return 4;" |
4227 "})() "; | 4227 "})() "; |
4228 | 4228 |
4229 // http://crbug.com/28933 | 4229 // http://crbug.com/28933 |
4230 // Test that debug break is disabled when bootstrapper is active. | 4230 // Test that debug break is disabled when bootstrapper is active. |
4231 TEST(NoBreakWhenBootstrapping) { | 4231 TEST(NoBreakWhenBootstrapping) { |
4232 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 4232 v8::Isolate* isolate = CcTest::isolate(); |
4233 v8::HandleScope scope(isolate); | 4233 v8::HandleScope scope(isolate); |
4234 | 4234 |
4235 // Register a debug event listener which sets the break flag and counts. | 4235 // Register a debug event listener which sets the break flag and counts. |
4236 v8::Debug::SetDebugEventListener2(DebugEventCounter); | 4236 v8::Debug::SetDebugEventListener2(DebugEventCounter); |
4237 | 4237 |
4238 // Set the debug break flag. | 4238 // Set the debug break flag. |
4239 v8::Debug::DebugBreak(isolate); | 4239 v8::Debug::DebugBreak(isolate); |
4240 break_point_hit_count = 0; | 4240 break_point_hit_count = 0; |
4241 { | 4241 { |
4242 // Create a context with an extension to make sure that some JavaScript | 4242 // Create a context with an extension to make sure that some JavaScript |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5142 "\n" | 5142 "\n" |
5143 "foo();\n"; | 5143 "foo();\n"; |
5144 | 5144 |
5145 v8::V8::Initialize(); | 5145 v8::V8::Initialize(); |
5146 DebugLocalContext env; | 5146 DebugLocalContext env; |
5147 v8::HandleScope scope(env->GetIsolate()); | 5147 v8::HandleScope scope(env->GetIsolate()); |
5148 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); | 5148 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); |
5149 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 5149 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); |
5150 global_template->Set(v8::String::New("ThreadedAtBarrier1"), | 5150 global_template->Set(v8::String::New("ThreadedAtBarrier1"), |
5151 v8::FunctionTemplate::New(ThreadedAtBarrier1)); | 5151 v8::FunctionTemplate::New(ThreadedAtBarrier1)); |
5152 v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(), | 5152 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(), |
5153 NULL, | 5153 NULL, |
5154 global_template); | 5154 global_template); |
5155 v8::Context::Scope context_scope(context); | 5155 v8::Context::Scope context_scope(context); |
5156 | 5156 |
5157 CompileRun(source); | 5157 CompileRun(source); |
5158 } | 5158 } |
5159 | 5159 |
5160 | 5160 |
5161 void DebuggerThread::Run() { | 5161 void DebuggerThread::Run() { |
5162 const int kBufSize = 1000; | 5162 const int kBufSize = 1000; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5495 static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) { | 5495 static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) { |
5496 CHECK(v8::Debug::Call(debugger_call_with_closure)->IsNumber()); | 5496 CHECK(v8::Debug::Call(debugger_call_with_closure)->IsNumber()); |
5497 CHECK_EQ(3, v8::Debug::Call(debugger_call_with_closure)->Int32Value()); | 5497 CHECK_EQ(3, v8::Debug::Call(debugger_call_with_closure)->Int32Value()); |
5498 } | 5498 } |
5499 | 5499 |
5500 | 5500 |
5501 // Test functions called through the debugger. | 5501 // Test functions called through the debugger. |
5502 TEST(CallFunctionInDebugger) { | 5502 TEST(CallFunctionInDebugger) { |
5503 // Create and enter a context with the functions CheckFrameCount, | 5503 // Create and enter a context with the functions CheckFrameCount, |
5504 // CheckSourceLine and CheckDataParameter installed. | 5504 // CheckSourceLine and CheckDataParameter installed. |
5505 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 5505 v8::HandleScope scope(CcTest::isolate()); |
5506 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 5506 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); |
5507 global_template->Set(v8::String::New("CheckFrameCount"), | 5507 global_template->Set(v8::String::New("CheckFrameCount"), |
5508 v8::FunctionTemplate::New(CheckFrameCount)); | 5508 v8::FunctionTemplate::New(CheckFrameCount)); |
5509 global_template->Set(v8::String::New("CheckSourceLine"), | 5509 global_template->Set(v8::String::New("CheckSourceLine"), |
5510 v8::FunctionTemplate::New(CheckSourceLine)); | 5510 v8::FunctionTemplate::New(CheckSourceLine)); |
5511 global_template->Set(v8::String::New("CheckDataParameter"), | 5511 global_template->Set(v8::String::New("CheckDataParameter"), |
5512 v8::FunctionTemplate::New(CheckDataParameter)); | 5512 v8::FunctionTemplate::New(CheckDataParameter)); |
5513 global_template->Set(v8::String::New("CheckClosure"), | 5513 global_template->Set(v8::String::New("CheckClosure"), |
5514 v8::FunctionTemplate::New(CheckClosure)); | 5514 v8::FunctionTemplate::New(CheckClosure)); |
5515 v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(), | 5515 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(), |
5516 NULL, | 5516 NULL, |
5517 global_template); | 5517 global_template); |
5518 v8::Context::Scope context_scope(context); | 5518 v8::Context::Scope context_scope(context); |
5519 | 5519 |
5520 // Compile a function for checking the number of JavaScript frames. | 5520 // Compile a function for checking the number of JavaScript frames. |
5521 v8::Script::Compile(v8::String::New(frame_count_source))->Run(); | 5521 v8::Script::Compile(v8::String::New(frame_count_source))->Run(); |
5522 frame_count = v8::Local<v8::Function>::Cast( | 5522 frame_count = v8::Local<v8::Function>::Cast( |
5523 context->Global()->Get(v8::String::New("frame_count"))); | 5523 context->Global()->Get(v8::String::New("frame_count"))); |
5524 | 5524 |
5525 // Compile a function for returning the source line for the top frame. | 5525 // Compile a function for returning the source line for the top frame. |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6227 if (IsBreakEventMessage(print_buffer)) { | 6227 if (IsBreakEventMessage(print_buffer)) { |
6228 SendContinueCommand(); | 6228 SendContinueCommand(); |
6229 } | 6229 } |
6230 } | 6230 } |
6231 | 6231 |
6232 | 6232 |
6233 // Test which creates two contexts and sets different embedder data on each. | 6233 // Test which creates two contexts and sets different embedder data on each. |
6234 // Checks that this data is set correctly and that when the debug message | 6234 // Checks that this data is set correctly and that when the debug message |
6235 // handler is called the expected context is the one active. | 6235 // handler is called the expected context is the one active. |
6236 TEST(ContextData) { | 6236 TEST(ContextData) { |
6237 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 6237 v8::Isolate* isolate = CcTest::isolate(); |
6238 v8::HandleScope scope(isolate); | 6238 v8::HandleScope scope(isolate); |
6239 | 6239 |
6240 // Create two contexts. | 6240 // Create two contexts. |
6241 v8::Handle<v8::Context> context_1; | 6241 v8::Handle<v8::Context> context_1; |
6242 v8::Handle<v8::Context> context_2; | 6242 v8::Handle<v8::Context> context_2; |
6243 v8::Handle<v8::ObjectTemplate> global_template = | 6243 v8::Handle<v8::ObjectTemplate> global_template = |
6244 v8::Handle<v8::ObjectTemplate>(); | 6244 v8::Handle<v8::ObjectTemplate>(); |
6245 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); | 6245 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); |
6246 context_1 = v8::Context::New(isolate, NULL, global_template, global_object); | 6246 context_1 = v8::Context::New(isolate, NULL, global_template, global_object); |
6247 context_2 = v8::Context::New(isolate, NULL, global_template, global_object); | 6247 context_2 = v8::Context::New(isolate, NULL, global_template, global_object); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6404 | 6404 |
6405 | 6405 |
6406 // Common part of EvalContextData and NestedBreakEventContextData tests. | 6406 // Common part of EvalContextData and NestedBreakEventContextData tests. |
6407 static void ExecuteScriptForContextCheck( | 6407 static void ExecuteScriptForContextCheck( |
6408 v8::Debug::MessageHandler2 message_handler) { | 6408 v8::Debug::MessageHandler2 message_handler) { |
6409 // Create a context. | 6409 // Create a context. |
6410 v8::Handle<v8::Context> context_1; | 6410 v8::Handle<v8::Context> context_1; |
6411 v8::Handle<v8::ObjectTemplate> global_template = | 6411 v8::Handle<v8::ObjectTemplate> global_template = |
6412 v8::Handle<v8::ObjectTemplate>(); | 6412 v8::Handle<v8::ObjectTemplate>(); |
6413 context_1 = | 6413 context_1 = |
6414 v8::Context::New(v8::Isolate::GetCurrent(), NULL, global_template); | 6414 v8::Context::New(CcTest::isolate(), NULL, global_template); |
6415 | 6415 |
6416 v8::Debug::SetMessageHandler2(message_handler); | 6416 v8::Debug::SetMessageHandler2(message_handler); |
6417 | 6417 |
6418 // Default data value is undefined. | 6418 // Default data value is undefined. |
6419 CHECK(context_1->GetEmbedderData(0)->IsUndefined()); | 6419 CHECK(context_1->GetEmbedderData(0)->IsUndefined()); |
6420 | 6420 |
6421 // Set and check a data value. | 6421 // Set and check a data value. |
6422 v8::Handle<v8::String> data_1 = v8::String::New("1"); | 6422 v8::Handle<v8::String> data_1 = v8::String::New("1"); |
6423 context_1->SetEmbedderData(0, data_1); | 6423 context_1->SetEmbedderData(0, data_1); |
6424 CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1)); | 6424 CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1)); |
(...skipping 12 matching lines...) Expand all Loading... |
6437 | 6437 |
6438 v8::Debug::SetMessageHandler2(NULL); | 6438 v8::Debug::SetMessageHandler2(NULL); |
6439 } | 6439 } |
6440 | 6440 |
6441 | 6441 |
6442 // Test which creates a context and sets embedder data on it. Checks that this | 6442 // Test which creates a context and sets embedder data on it. Checks that this |
6443 // data is set correctly and that when the debug message handler is called for | 6443 // data is set correctly and that when the debug message handler is called for |
6444 // break event in an eval statement the expected context is the one returned by | 6444 // break event in an eval statement the expected context is the one returned by |
6445 // Message.GetEventContext. | 6445 // Message.GetEventContext. |
6446 TEST(EvalContextData) { | 6446 TEST(EvalContextData) { |
6447 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 6447 v8::HandleScope scope(CcTest::isolate()); |
6448 | 6448 |
6449 ExecuteScriptForContextCheck(ContextCheckMessageHandler); | 6449 ExecuteScriptForContextCheck(ContextCheckMessageHandler); |
6450 | 6450 |
6451 // One time compile event and one time break event. | 6451 // One time compile event and one time break event. |
6452 CHECK_GT(message_handler_hit_count, 2); | 6452 CHECK_GT(message_handler_hit_count, 2); |
6453 CheckDebuggerUnloaded(); | 6453 CheckDebuggerUnloaded(); |
6454 } | 6454 } |
6455 | 6455 |
6456 | 6456 |
6457 static bool sent_eval = false; | 6457 static bool sent_eval = false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6500 // send continue. | 6500 // send continue. |
6501 SendContinueCommand(); | 6501 SendContinueCommand(); |
6502 continue_command_send_count++; | 6502 continue_command_send_count++; |
6503 } | 6503 } |
6504 } | 6504 } |
6505 | 6505 |
6506 | 6506 |
6507 // Tests that context returned for break event is correct when the event occurs | 6507 // Tests that context returned for break event is correct when the event occurs |
6508 // in 'evaluate' debugger request. | 6508 // in 'evaluate' debugger request. |
6509 TEST(NestedBreakEventContextData) { | 6509 TEST(NestedBreakEventContextData) { |
6510 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 6510 v8::HandleScope scope(CcTest::isolate()); |
6511 break_count = 0; | 6511 break_count = 0; |
6512 message_handler_hit_count = 0; | 6512 message_handler_hit_count = 0; |
6513 | 6513 |
6514 ExecuteScriptForContextCheck(DebugEvalContextCheckMessageHandler); | 6514 ExecuteScriptForContextCheck(DebugEvalContextCheckMessageHandler); |
6515 | 6515 |
6516 // One time compile event and two times break event. | 6516 // One time compile event and two times break event. |
6517 CHECK_GT(message_handler_hit_count, 3); | 6517 CHECK_GT(message_handler_hit_count, 3); |
6518 | 6518 |
6519 // One break from the source and another from the evaluate request. | 6519 // One break from the source and another from the evaluate request. |
6520 CHECK_EQ(break_count, 2); | 6520 CHECK_EQ(break_count, 2); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6576 v8::Handle<v8::Context> context = message.GetEventContext(); | 6576 v8::Handle<v8::Context> context = message.GetEventContext(); |
6577 CHECK(context.IsEmpty()); | 6577 CHECK(context.IsEmpty()); |
6578 } | 6578 } |
6579 } | 6579 } |
6580 | 6580 |
6581 | 6581 |
6582 // Test that GetEventContext doesn't fail and return empty handle for | 6582 // Test that GetEventContext doesn't fail and return empty handle for |
6583 // ScriptCollected events. | 6583 // ScriptCollected events. |
6584 TEST(ScriptCollectedEventContext) { | 6584 TEST(ScriptCollectedEventContext) { |
6585 i::FLAG_stress_compaction = false; | 6585 i::FLAG_stress_compaction = false; |
6586 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 6586 v8::Isolate* isolate = CcTest::isolate(); |
6587 v8::internal::Debug* debug = | 6587 v8::internal::Debug* debug = |
6588 reinterpret_cast<v8::internal::Isolate*>(isolate)->debug(); | 6588 reinterpret_cast<v8::internal::Isolate*>(isolate)->debug(); |
6589 script_collected_message_count = 0; | 6589 script_collected_message_count = 0; |
6590 v8::HandleScope scope(isolate); | 6590 v8::HandleScope scope(isolate); |
6591 | 6591 |
6592 v8::Persistent<v8::Context> context; | 6592 v8::Persistent<v8::Context> context; |
6593 { | 6593 { |
6594 v8::HandleScope scope(isolate); | 6594 v8::HandleScope scope(isolate); |
6595 context.Reset(isolate, v8::Context::New(isolate)); | 6595 context.Reset(isolate, v8::Context::New(isolate)); |
6596 } | 6596 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7072 CHECK_EQ(1, break_point_hit_count); | 7072 CHECK_EQ(1, break_point_hit_count); |
7073 | 7073 |
7074 v8::Debug::SetDebugEventListener2(NULL); | 7074 v8::Debug::SetDebugEventListener2(NULL); |
7075 debugee_context = v8::Handle<v8::Context>(); | 7075 debugee_context = v8::Handle<v8::Context>(); |
7076 debugger_context = v8::Handle<v8::Context>(); | 7076 debugger_context = v8::Handle<v8::Context>(); |
7077 CheckDebuggerUnloaded(); | 7077 CheckDebuggerUnloaded(); |
7078 } | 7078 } |
7079 | 7079 |
7080 | 7080 |
7081 TEST(DebugContextIsPreservedBetweenAccesses) { | 7081 TEST(DebugContextIsPreservedBetweenAccesses) { |
7082 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 7082 v8::HandleScope scope(CcTest::isolate()); |
7083 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); | 7083 v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); |
7084 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); | 7084 v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); |
7085 CHECK_EQ(*context1, *context2); | 7085 CHECK_EQ(*context1, *context2); |
7086 } | 7086 } |
7087 | 7087 |
7088 | 7088 |
7089 static v8::Handle<v8::Value> expected_callback_data; | 7089 static v8::Handle<v8::Value> expected_callback_data; |
7090 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { | 7090 static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { |
7091 CHECK(details.GetEventContext() == expected_context); | 7091 CHECK(details.GetEventContext() == expected_context); |
7092 CHECK_EQ(expected_callback_data, details.GetCallbackData()); | 7092 CHECK_EQ(expected_callback_data, details.GetCallbackData()); |
7093 } | 7093 } |
7094 | 7094 |
7095 | 7095 |
7096 // Check that event details contain context where debug event occured. | 7096 // Check that event details contain context where debug event occured. |
7097 TEST(DebugEventContext) { | 7097 TEST(DebugEventContext) { |
7098 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 7098 v8::Isolate* isolate = CcTest::isolate(); |
7099 v8::HandleScope scope(isolate); | 7099 v8::HandleScope scope(isolate); |
7100 expected_callback_data = v8::Int32::New(2010); | 7100 expected_callback_data = v8::Int32::New(2010); |
7101 expected_context = v8::Context::New(isolate); | 7101 expected_context = v8::Context::New(isolate); |
7102 v8::Debug::SetDebugEventListener2(DebugEventContextChecker, | 7102 v8::Debug::SetDebugEventListener2(DebugEventContextChecker, |
7103 expected_callback_data); | 7103 expected_callback_data); |
7104 v8::Context::Scope context_scope(expected_context); | 7104 v8::Context::Scope context_scope(expected_context); |
7105 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); | 7105 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); |
7106 expected_context.Clear(); | 7106 expected_context.Clear(); |
7107 v8::Debug::SetDebugEventListener2(NULL); | 7107 v8::Debug::SetDebugEventListener2(NULL); |
7108 expected_context_data = v8::Handle<v8::Value>(); | 7108 expected_context_data = v8::Handle<v8::Value>(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7194 CHECK(result->IsString()); | 7194 CHECK(result->IsString()); |
7195 v8::Handle<v8::String> function_name(result->ToString()); | 7195 v8::Handle<v8::String> function_name(result->ToString()); |
7196 function_name->WriteUtf8(fn); | 7196 function_name->WriteUtf8(fn); |
7197 if (strcmp(fn, "bar") == 0) { | 7197 if (strcmp(fn, "bar") == 0) { |
7198 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); | 7198 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); |
7199 debug_event_break_deoptimize_done = true; | 7199 debug_event_break_deoptimize_done = true; |
7200 } | 7200 } |
7201 } | 7201 } |
7202 } | 7202 } |
7203 | 7203 |
7204 v8::Debug::DebugBreak(v8::Isolate::GetCurrent()); | 7204 v8::Debug::DebugBreak(CcTest::isolate()); |
7205 } | 7205 } |
7206 } | 7206 } |
7207 | 7207 |
7208 | 7208 |
7209 // Test deoptimization when execution is broken using the debug break stack | 7209 // Test deoptimization when execution is broken using the debug break stack |
7210 // check interrupt. | 7210 // check interrupt. |
7211 TEST(DeoptimizeDuringDebugBreak) { | 7211 TEST(DeoptimizeDuringDebugBreak) { |
7212 DebugLocalContext env; | 7212 DebugLocalContext env; |
7213 v8::HandleScope scope(env->GetIsolate()); | 7213 v8::HandleScope scope(env->GetIsolate()); |
7214 env.ExposeDebug(); | 7214 env.ExposeDebug(); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7549 TEST(LiveEditDisabled) { | 7549 TEST(LiveEditDisabled) { |
7550 v8::internal::FLAG_allow_natives_syntax = true; | 7550 v8::internal::FLAG_allow_natives_syntax = true; |
7551 LocalContext env; | 7551 LocalContext env; |
7552 v8::HandleScope scope(env->GetIsolate()); | 7552 v8::HandleScope scope(env->GetIsolate()); |
7553 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); | 7553 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); |
7554 CompileRun("%LiveEditCompareStrings('', '')"); | 7554 CompileRun("%LiveEditCompareStrings('', '')"); |
7555 } | 7555 } |
7556 | 7556 |
7557 | 7557 |
7558 #endif // ENABLE_DEBUGGER_SUPPORT | 7558 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |