| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 inline ~DebugLocalContext() { | 143 inline ~DebugLocalContext() { |
| 144 context_->Exit(); | 144 context_->Exit(); |
| 145 } | 145 } |
| 146 inline v8::Context* operator->() { return *context_; } | 146 inline v8::Context* operator->() { return *context_; } |
| 147 inline v8::Context* operator*() { return *context_; } | 147 inline v8::Context* operator*() { return *context_; } |
| 148 inline bool IsReady() { return !context_.IsEmpty(); } | 148 inline bool IsReady() { return !context_.IsEmpty(); } |
| 149 void ExposeDebug() { | 149 void ExposeDebug() { |
| 150 v8::internal::Isolate* isolate = | 150 v8::internal::Isolate* isolate = |
| 151 reinterpret_cast<v8::internal::Isolate*>(context_->GetIsolate()); | 151 reinterpret_cast<v8::internal::Isolate*>(context_->GetIsolate()); |
| 152 v8::internal::Factory* factory = isolate->factory(); |
| 152 v8::internal::Debug* debug = isolate->debug(); | 153 v8::internal::Debug* debug = isolate->debug(); |
| 153 // Expose the debug context global object in the global object for testing. | 154 // Expose the debug context global object in the global object for testing. |
| 154 debug->Load(); | 155 debug->Load(); |
| 155 debug->debug_context()->set_security_token( | 156 debug->debug_context()->set_security_token( |
| 156 v8::Utils::OpenHandle(*context_)->security_token()); | 157 v8::Utils::OpenHandle(*context_)->security_token()); |
| 157 | 158 |
| 158 Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast( | 159 Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast( |
| 159 v8::Utils::OpenHandle(*context_->Global()))); | 160 v8::Utils::OpenHandle(*context_->Global()))); |
| 160 Handle<v8::internal::String> debug_string = | 161 Handle<v8::internal::String> debug_string = |
| 161 FACTORY->InternalizeOneByteString(STATIC_ASCII_VECTOR("debug")); | 162 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("debug")); |
| 162 SetProperty(isolate, global, debug_string, | 163 SetProperty(isolate, global, debug_string, |
| 163 Handle<Object>(debug->debug_context()->global_proxy(), isolate), | 164 Handle<Object>(debug->debug_context()->global_proxy(), isolate), |
| 164 DONT_ENUM, | 165 DONT_ENUM, |
| 165 ::v8::internal::kNonStrictMode); | 166 ::v8::internal::kNonStrictMode); |
| 166 } | 167 } |
| 167 | 168 |
| 168 private: | 169 private: |
| 169 v8::HandleScope scope_; | 170 v8::HandleScope scope_; |
| 170 v8::Local<v8::Context> context_; | 171 v8::Local<v8::Context> context_; |
| 171 }; | 172 }; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 398 |
| 398 // Find the number of debugged functions. | 399 // Find the number of debugged functions. |
| 399 int count = 0; | 400 int count = 0; |
| 400 while (node) { | 401 while (node) { |
| 401 count++; | 402 count++; |
| 402 node = node->next(); | 403 node = node->next(); |
| 403 } | 404 } |
| 404 | 405 |
| 405 // Allocate array for the debugged functions | 406 // Allocate array for the debugged functions |
| 406 Handle<FixedArray> debugged_functions = | 407 Handle<FixedArray> debugged_functions = |
| 407 FACTORY->NewFixedArray(count); | 408 Isolate::Current()->factory()->NewFixedArray(count); |
| 408 | 409 |
| 409 // Run through the debug info objects and collect all functions. | 410 // Run through the debug info objects and collect all functions. |
| 410 count = 0; | 411 count = 0; |
| 411 while (node) { | 412 while (node) { |
| 412 debugged_functions->set(count++, *node->debug_info()); | 413 debugged_functions->set(count++, *node->debug_info()); |
| 413 node = node->next(); | 414 node = node->next(); |
| 414 } | 415 } |
| 415 | 416 |
| 416 return debugged_functions; | 417 return debugged_functions; |
| 417 } | 418 } |
| (...skipping 7152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7570 TEST(LiveEditDisabled) { | 7571 TEST(LiveEditDisabled) { |
| 7571 v8::internal::FLAG_allow_natives_syntax = true; | 7572 v8::internal::FLAG_allow_natives_syntax = true; |
| 7572 LocalContext env; | 7573 LocalContext env; |
| 7573 v8::HandleScope scope(env->GetIsolate()); | 7574 v8::HandleScope scope(env->GetIsolate()); |
| 7574 v8::Debug::SetLiveEditEnabled(false); | 7575 v8::Debug::SetLiveEditEnabled(false); |
| 7575 CompileRun("%LiveEditCompareStrings('', '')"); | 7576 CompileRun("%LiveEditCompareStrings('', '')"); |
| 7576 } | 7577 } |
| 7577 | 7578 |
| 7578 | 7579 |
| 7579 #endif // ENABLE_DEBUGGER_SUPPORT | 7580 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |