| 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 20128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20139 fun->Call(CcTest::global(), 1, &break_id); | 20139 fun->Call(CcTest::global(), 1, &break_id); |
| 20140 } | 20140 } |
| 20141 | 20141 |
| 20142 | 20142 |
| 20143 TEST(Regress385349) { | 20143 TEST(Regress385349) { |
| 20144 i::FLAG_allow_natives_syntax = true; | 20144 i::FLAG_allow_natives_syntax = true; |
| 20145 v8::Isolate* isolate = CcTest::isolate(); | 20145 v8::Isolate* isolate = CcTest::isolate(); |
| 20146 HandleScope handle_scope(isolate); | 20146 HandleScope handle_scope(isolate); |
| 20147 isolate->SetAutorunMicrotasks(false); | 20147 isolate->SetAutorunMicrotasks(false); |
| 20148 Local<Context> context = Context::New(isolate); | 20148 Local<Context> context = Context::New(isolate); |
| 20149 v8::Debug::SetDebugEventListener(DebugEventInObserver); | 20149 v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver); |
| 20150 { | 20150 { |
| 20151 Context::Scope context_scope(context); | 20151 Context::Scope context_scope(context); |
| 20152 CompileRun("var obj = {};" | 20152 CompileRun("var obj = {};" |
| 20153 "Object.observe(obj, function(changes) { debugger; });" | 20153 "Object.observe(obj, function(changes) { debugger; });" |
| 20154 "obj.a = 0;"); | 20154 "obj.a = 0;"); |
| 20155 } | 20155 } |
| 20156 isolate->RunMicrotasks(); | 20156 isolate->RunMicrotasks(); |
| 20157 isolate->SetAutorunMicrotasks(true); | 20157 isolate->SetAutorunMicrotasks(true); |
| 20158 v8::Debug::SetDebugEventListener(NULL); | 20158 v8::Debug::SetDebugEventListener(isolate, nullptr); |
| 20159 } | 20159 } |
| 20160 | 20160 |
| 20161 | 20161 |
| 20162 #ifdef ENABLE_DISASSEMBLER | 20162 #ifdef ENABLE_DISASSEMBLER |
| 20163 static int probes_counter = 0; | 20163 static int probes_counter = 0; |
| 20164 static int misses_counter = 0; | 20164 static int misses_counter = 0; |
| 20165 static int updates_counter = 0; | 20165 static int updates_counter = 0; |
| 20166 | 20166 |
| 20167 | 20167 |
| 20168 static int* LookupCounter(const char* name) { | 20168 static int* LookupCounter(const char* name) { |
| (...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22684 v8::ScriptCompiler::StartStreamingScript(isolate, &source); | 22684 v8::ScriptCompiler::StartStreamingScript(isolate, &source); |
| 22685 | 22685 |
| 22686 task->Run(); | 22686 task->Run(); |
| 22687 delete task; | 22687 delete task; |
| 22688 | 22688 |
| 22689 CHECK(!try_catch.HasCaught()); | 22689 CHECK(!try_catch.HasCaught()); |
| 22690 | 22690 |
| 22691 v8::ScriptOrigin origin(v8_str("http://foo.com")); | 22691 v8::ScriptOrigin origin(v8_str("http://foo.com")); |
| 22692 char* full_source = TestSourceStream::FullSourceString(chunks); | 22692 char* full_source = TestSourceStream::FullSourceString(chunks); |
| 22693 | 22693 |
| 22694 EnableDebugger(); | 22694 EnableDebugger(isolate); |
| 22695 | 22695 |
| 22696 v8::Local<Script> script = v8::ScriptCompiler::Compile( | 22696 v8::Local<Script> script = v8::ScriptCompiler::Compile( |
| 22697 isolate, &source, v8_str(full_source), origin); | 22697 isolate, &source, v8_str(full_source), origin); |
| 22698 | 22698 |
| 22699 Maybe<uint32_t> result = | 22699 Maybe<uint32_t> result = |
| 22700 script->Run(env.local()).ToLocalChecked()->Uint32Value(env.local()); | 22700 script->Run(env.local()).ToLocalChecked()->Uint32Value(env.local()); |
| 22701 CHECK_EQ(3U, result.FromMaybe(0)); | 22701 CHECK_EQ(3U, result.FromMaybe(0)); |
| 22702 | 22702 |
| 22703 delete[] full_source; | 22703 delete[] full_source; |
| 22704 | 22704 |
| 22705 DisableDebugger(); | 22705 DisableDebugger(isolate); |
| 22706 } | 22706 } |
| 22707 | 22707 |
| 22708 | 22708 |
| 22709 TEST(StreamingScriptWithInvalidUtf8) { | 22709 TEST(StreamingScriptWithInvalidUtf8) { |
| 22710 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a | 22710 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a |
| 22711 // chunk don't produce a crash. | 22711 // chunk don't produce a crash. |
| 22712 const char* reference = "\xec\x92\x81\x80\x80"; | 22712 const char* reference = "\xec\x92\x81\x80\x80"; |
| 22713 char chunk1[] = | 22713 char chunk1[] = |
| 22714 "function foo() {\n" | 22714 "function foo() {\n" |
| 22715 " // This function will contain an UTF-8 character which is not in\n" | 22715 " // This function will contain an UTF-8 character which is not in\n" |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23829 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23829 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
| 23830 ExpectString("typeof obj2.values", "function"); | 23830 ExpectString("typeof obj2.values", "function"); |
| 23831 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23831 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
| 23832 | 23832 |
| 23833 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23833 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
| 23834 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23834 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
| 23835 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23835 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
| 23836 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23836 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
| 23837 } | 23837 } |
| 23838 } | 23838 } |
| OLD | NEW |