| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 CHECK_EQ(4, CompileRun("ordering[3]")->Int32Value()); | 89 CHECK_EQ(4, CompileRun("ordering[3]")->Int32Value()); |
| 90 CHECK_EQ(5, CompileRun("ordering[4]")->Int32Value()); | 90 CHECK_EQ(5, CompileRun("ordering[4]")->Int32Value()); |
| 91 CHECK_EQ(6, CompileRun("ordering[5]")->Int32Value()); | 91 CHECK_EQ(6, CompileRun("ordering[5]")->Int32Value()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 TEST(MicrotaskPerIsolateState) { | 95 TEST(MicrotaskPerIsolateState) { |
| 96 HarmonyIsolate isolate; | 96 HarmonyIsolate isolate; |
| 97 HandleScope scope(isolate.GetIsolate()); | 97 HandleScope scope(isolate.GetIsolate()); |
| 98 LocalContext context1(isolate.GetIsolate()); | 98 LocalContext context1(isolate.GetIsolate()); |
| 99 V8::SetAutorunMicrotasks(isolate.GetIsolate(), false); | 99 isolate.GetIsolate()->SetAutorunMicrotasks(false); |
| 100 CompileRun( | 100 CompileRun( |
| 101 "var obj = { calls: 0 };"); | 101 "var obj = { calls: 0 };"); |
| 102 Handle<Value> obj = CompileRun("obj"); | 102 Handle<Value> obj = CompileRun("obj"); |
| 103 { | 103 { |
| 104 LocalContext context2(isolate.GetIsolate()); | 104 LocalContext context2(isolate.GetIsolate()); |
| 105 context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), | 105 context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), |
| 106 obj); | 106 obj); |
| 107 CompileRun( | 107 CompileRun( |
| 108 "var resolver = {};" | 108 "var resolver = {};" |
| 109 "new Promise(function(resolve) {" | 109 "new Promise(function(resolve) {" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 123 "var foo = { id: 1 };" | 123 "var foo = { id: 1 };" |
| 124 "Object.observe(foo, function() {" | 124 "Object.observe(foo, function() {" |
| 125 "obj.calls++;" | 125 "obj.calls++;" |
| 126 "});" | 126 "});" |
| 127 "foo.id++;"); | 127 "foo.id++;"); |
| 128 } | 128 } |
| 129 { | 129 { |
| 130 LocalContext context4(isolate.GetIsolate()); | 130 LocalContext context4(isolate.GetIsolate()); |
| 131 context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), | 131 context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), |
| 132 obj); | 132 obj); |
| 133 V8::RunMicrotasks(isolate.GetIsolate()); | 133 isolate.GetIsolate()->RunMicrotasks(); |
| 134 CHECK_EQ(2, CompileRun("obj.calls")->Int32Value()); | 134 CHECK_EQ(2, CompileRun("obj.calls")->Int32Value()); |
| 135 } | 135 } |
| 136 } | 136 } |
| OLD | NEW |