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

Side by Side Diff: src/execution.cc

Issue 1433423004: Introduce JavascriptExecutionObserver scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/execution.h" 5 #include "src/execution.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 DCHECK(!receiver->IsJSGlobalObject()); 61 DCHECK(!receiver->IsJSGlobalObject());
62 62
63 // Entering JavaScript. 63 // Entering JavaScript.
64 VMState<JS> state(isolate); 64 VMState<JS> state(isolate);
65 CHECK(AllowJavascriptExecution::IsAllowed(isolate)); 65 CHECK(AllowJavascriptExecution::IsAllowed(isolate));
66 if (!ThrowOnJavascriptExecution::IsAllowed(isolate)) { 66 if (!ThrowOnJavascriptExecution::IsAllowed(isolate)) {
67 isolate->ThrowIllegalOperation(); 67 isolate->ThrowIllegalOperation();
68 isolate->ReportPendingMessages(); 68 isolate->ReportPendingMessages();
69 return MaybeHandle<Object>(); 69 return MaybeHandle<Object>();
70 } 70 }
71 JavascriptExecutionObserver::SetObserved(isolate);
71 72
72 // Placeholder for return value. 73 // Placeholder for return value.
73 Object* value = NULL; 74 Object* value = NULL;
74 75
75 typedef Object* (*JSEntryFunction)(Object* new_target, Object* target, 76 typedef Object* (*JSEntryFunction)(Object* new_target, Object* target,
76 Object* receiver, int argc, 77 Object* receiver, int argc,
77 Object*** args); 78 Object*** args);
78 79
79 Handle<Code> code = is_construct 80 Handle<Code> code = is_construct
80 ? isolate->factory()->js_construct_entry_code() 81 ? isolate->factory()->js_construct_entry_code()
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 isolate_->InvokeApiInterruptCallbacks(); 529 isolate_->InvokeApiInterruptCallbacks();
529 } 530 }
530 531
531 isolate_->counters()->stack_interrupts()->Increment(); 532 isolate_->counters()->stack_interrupts()->Increment();
532 isolate_->counters()->runtime_profiler_ticks()->Increment(); 533 isolate_->counters()->runtime_profiler_ticks()->Increment();
533 isolate_->runtime_profiler()->OptimizeNow(); 534 isolate_->runtime_profiler()->OptimizeNow();
534 535
535 return isolate_->heap()->undefined_value(); 536 return isolate_->heap()->undefined_value();
536 } 537 }
537 538
539
540 JavascriptExecutionObserver::JavascriptExecutionObserver(Isolate* isolate)
541 : isolate_(isolate), observed_(false) {
542 prev_ = isolate->execution_observer();
543 isolate->set_execution_observer(this);
544 }
545
546
547 JavascriptExecutionObserver::~JavascriptExecutionObserver() {
548 isolate_->set_execution_observer(prev_);
549 }
550
551
552 void JavascriptExecutionObserver::SetObserved(Isolate* isolate) {
553 for (JavascriptExecutionObserver* observer = isolate->execution_observer();
554 observer != NULL; observer = observer->prev_) {
555 // If this observer is already set to true, so are all its predecessors.
556 if (observer->observed_) break;
557 observer->observed_ = true;
558 }
559 }
560
538 } // namespace internal 561 } // namespace internal
539 } // namespace v8 562 } // namespace v8
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698