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 20566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20577 env->Global()->Set(v8_str("func"), func); | 20577 env->Global()->Set(v8_str("func"), func); |
20578 Local<Value> result = CompileRun("func();"); | 20578 Local<Value> result = CompileRun("func();"); |
20579 CHECK_EQ(v8::Integer::New(17, isolate), result); | 20579 CHECK_EQ(v8::Integer::New(17, isolate), result); |
20580 // Verify function not cached | 20580 // Verify function not cached |
20581 int serial_number = | 20581 int serial_number = |
20582 i::Smi::cast(v8::Utils::OpenHandle(*func) | 20582 i::Smi::cast(v8::Utils::OpenHandle(*func) |
20583 ->shared()->get_api_func_data()->serial_number())->value(); | 20583 ->shared()->get_api_func_data()->serial_number())->value(); |
20584 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 20584 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
20585 i::Object* elm = i_isolate->native_context()->function_cache() | 20585 i::Object* elm = i_isolate->native_context()->function_cache() |
20586 ->GetElementNoExceptionThrown(i_isolate, serial_number); | 20586 ->GetElementNoExceptionThrown(i_isolate, serial_number); |
20587 CHECK(elm->IsNull()); | 20587 CHECK(elm->IsUndefined()); |
| 20588 // Verify that each Function::New creates a new function instance |
| 20589 Local<Object> data2 = v8::Object::New(); |
| 20590 function_new_expected_env = data2; |
| 20591 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); |
| 20592 CHECK(!func2->IsNull()); |
| 20593 CHECK_NE(func, func2); |
| 20594 env->Global()->Set(v8_str("func2"), func2); |
| 20595 Local<Value> result2 = CompileRun("func2();"); |
| 20596 CHECK_EQ(v8::Integer::New(17, isolate), result2); |
20588 } | 20597 } |
20589 | 20598 |
OLD | NEW |