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

Side by Side Diff: test/cctest/test-api.cc

Issue 332923003: Run JS micro tasks in the appropriate context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20935 matching lines...) Expand 10 before | Expand all | Expand 10 after
20946 } 20946 }
20947 isolate->RunMicrotasks(); 20947 isolate->RunMicrotasks();
20948 { 20948 {
20949 Context::Scope context_scope(context); 20949 Context::Scope context_scope(context);
20950 CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value()); 20950 CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
20951 } 20951 }
20952 isolate->SetAutorunMicrotasks(true); 20952 isolate->SetAutorunMicrotasks(true);
20953 } 20953 }
20954 20954
20955 20955
20956 static void DebugEventInObserver(const v8::Debug::EventDetails& event_details) {
20957 v8::DebugEvent event = event_details.GetEvent();
20958 if (event != v8::Break) return;
20959 Handle<Object> exec_state = event_details.GetExecutionState();
20960 Handle<Value> break_id = exec_state->Get(v8_str("break_id"));
20961 CompileRun("function f(id) { new FrameDetails(id, 0); }");
20962 Handle<Function> fun = Handle<Function>::Cast(
20963 CcTest::global()->Get(v8_str("f"))->ToObject());
20964 fun->Call(CcTest::global(), 1, &break_id);
20965 }
20966
20967
20968 TEST(Regress385349) {
20969 i::FLAG_allow_natives_syntax = true;
20970 v8::Isolate* isolate = CcTest::isolate();
20971 HandleScope handle_scope(isolate);
20972 isolate->SetAutorunMicrotasks(false);
20973 Handle<Context> context = Context::New(isolate);
20974 v8::Debug::SetDebugEventListener(DebugEventInObserver);
20975 {
20976 Context::Scope context_scope(context);
20977 CompileRun("var obj = {};"
20978 "Object.observe(obj, function(changes) { debugger; });"
20979 "obj.a = 0;");
20980 }
20981 isolate->RunMicrotasks();
20982 isolate->SetAutorunMicrotasks(true);
20983 v8::Debug::SetDebugEventListener(NULL);
20984 }
20985
20986
20956 static int probes_counter = 0; 20987 static int probes_counter = 0;
20957 static int misses_counter = 0; 20988 static int misses_counter = 0;
20958 static int updates_counter = 0; 20989 static int updates_counter = 0;
20959 20990
20960 20991
20961 static int* LookupCounter(const char* name) { 20992 static int* LookupCounter(const char* name) {
20962 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { 20993 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) {
20963 return &probes_counter; 20994 return &probes_counter;
20964 } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) { 20995 } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) {
20965 return &misses_counter; 20996 return &misses_counter;
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
22848 call_eval_context = v8::Context::New(isolate); 22879 call_eval_context = v8::Context::New(isolate);
22849 v8::Context::Scope scope(call_eval_context); 22880 v8::Context::Scope scope(call_eval_context);
22850 call_eval_bound_function = 22881 call_eval_bound_function =
22851 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); 22882 Local<Function>::Cast(CompileRun("eval.bind(this, '1')"));
22852 } 22883 }
22853 env->Global()->Set(v8_str("CallEval"), 22884 env->Global()->Set(v8_str("CallEval"),
22854 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); 22885 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction());
22855 Local<Value> result = CompileRun("CallEval();"); 22886 Local<Value> result = CompileRun("CallEval();");
22856 CHECK_EQ(result, v8::Integer::New(isolate, 1)); 22887 CHECK_EQ(result, v8::Integer::New(isolate, 1));
22857 } 22888 }
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698