| 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 22789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22800 Local<Value> result = CompileRun("func();"); | 22800 Local<Value> result = CompileRun("func();"); |
| 22801 CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result).FromJust()); | 22801 CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result).FromJust()); |
| 22802 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 22802 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 22803 // Verify function not cached | 22803 // Verify function not cached |
| 22804 auto serial_number = handle( | 22804 auto serial_number = handle( |
| 22805 i::Smi::cast(i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*func)) | 22805 i::Smi::cast(i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*func)) |
| 22806 ->shared() | 22806 ->shared() |
| 22807 ->get_api_func_data() | 22807 ->get_api_func_data() |
| 22808 ->serial_number()), | 22808 ->serial_number()), |
| 22809 i_isolate); | 22809 i_isolate); |
| 22810 auto cache = i_isolate->template_instantiations_cache(); | 22810 auto slow_cache = i_isolate->slow_template_instantiations_cache(); |
| 22811 CHECK(cache->FindEntry(static_cast<uint32_t>(serial_number->value())) == | 22811 CHECK(slow_cache->FindEntry(static_cast<uint32_t>(serial_number->value())) == |
| 22812 i::UnseededNumberDictionary::kNotFound); | 22812 i::UnseededNumberDictionary::kNotFound); |
| 22813 auto fast_cache = i_isolate->fast_template_instantiations_cache(); |
| 22814 CHECK(fast_cache->get(static_cast<uint32_t>(serial_number->value())) |
| 22815 ->IsUndefined(i_isolate)); |
| 22813 // Verify that each Function::New creates a new function instance | 22816 // Verify that each Function::New creates a new function instance |
| 22814 Local<Object> data2 = v8::Object::New(isolate); | 22817 Local<Object> data2 = v8::Object::New(isolate); |
| 22815 function_new_expected_env = data2; | 22818 function_new_expected_env = data2; |
| 22816 Local<Function> func2 = | 22819 Local<Function> func2 = |
| 22817 Function::New(env.local(), FunctionNewCallback, data2).ToLocalChecked(); | 22820 Function::New(env.local(), FunctionNewCallback, data2).ToLocalChecked(); |
| 22818 CHECK(!func2->IsNull()); | 22821 CHECK(!func2->IsNull()); |
| 22819 CHECK(!func->Equals(env.local(), func2).FromJust()); | 22822 CHECK(!func->Equals(env.local(), func2).FromJust()); |
| 22820 CHECK(env->Global()->Set(env.local(), v8_str("func2"), func2).FromJust()); | 22823 CHECK(env->Global()->Set(env.local(), v8_str("func2"), func2).FromJust()); |
| 22821 Local<Value> result2 = CompileRun("func2();"); | 22824 Local<Value> result2 = CompileRun("func2();"); |
| 22822 CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result2).FromJust()); | 22825 CHECK(v8::Integer::New(isolate, 17)->Equals(env.local(), result2).FromJust()); |
| (...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25453 | 25456 |
| 25454 // Put the function into context1 and call it. Since the access check | 25457 // Put the function into context1 and call it. Since the access check |
| 25455 // callback always returns true, the call succeeds even though the tokens | 25458 // callback always returns true, the call succeeds even though the tokens |
| 25456 // are different. | 25459 // are different. |
| 25457 context1->Enter(); | 25460 context1->Enter(); |
| 25458 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); | 25461 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); |
| 25459 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); | 25462 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); |
| 25460 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); | 25463 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); |
| 25461 context1->Exit(); | 25464 context1->Exit(); |
| 25462 } | 25465 } |
| OLD | NEW |