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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 CHECK_EQ(6, | 98 CHECK_EQ(6, |
99 CompileRun("ordering[5]")->Int32Value(context.local()).FromJust()); | 99 CompileRun("ordering[5]")->Int32Value(context.local()).FromJust()); |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 TEST(MicrotaskPerIsolateState) { | 103 TEST(MicrotaskPerIsolateState) { |
104 i::FLAG_harmony_object_observe = true; | 104 i::FLAG_harmony_object_observe = true; |
105 HarmonyIsolate isolate; | 105 HarmonyIsolate isolate; |
106 v8::HandleScope scope(isolate.GetIsolate()); | 106 v8::HandleScope scope(isolate.GetIsolate()); |
107 LocalContext context1(isolate.GetIsolate()); | 107 LocalContext context1(isolate.GetIsolate()); |
108 isolate.GetIsolate()->SetAutorunMicrotasks(false); | 108 isolate.GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit); |
109 CompileRun( | 109 CompileRun( |
110 "var obj = { calls: 0 };"); | 110 "var obj = { calls: 0 };"); |
111 v8::Local<v8::Value> obj = CompileRun("obj"); | 111 v8::Local<v8::Value> obj = CompileRun("obj"); |
112 { | 112 { |
113 LocalContext context2(isolate.GetIsolate()); | 113 LocalContext context2(isolate.GetIsolate()); |
114 context2->Global() | 114 context2->Global() |
115 ->Set(context2.local(), | 115 ->Set(context2.local(), |
116 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", | 116 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", |
117 v8::NewStringType::kNormal) | 117 v8::NewStringType::kNormal) |
118 .ToLocalChecked(), | 118 .ToLocalChecked(), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", | 152 v8::String::NewFromUtf8(isolate.GetIsolate(), "obj", |
153 v8::NewStringType::kNormal) | 153 v8::NewStringType::kNormal) |
154 .ToLocalChecked(), | 154 .ToLocalChecked(), |
155 obj) | 155 obj) |
156 .FromJust(); | 156 .FromJust(); |
157 isolate.GetIsolate()->RunMicrotasks(); | 157 isolate.GetIsolate()->RunMicrotasks(); |
158 CHECK_EQ(2, | 158 CHECK_EQ(2, |
159 CompileRun("obj.calls")->Int32Value(context4.local()).FromJust()); | 159 CompileRun("obj.calls")->Int32Value(context4.local()).FromJust()); |
160 } | 160 } |
161 } | 161 } |
OLD | NEW |