| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE); | 429 &cache, CONSUME_CACHED_DATA, NOT_NATIVES_CODE); |
| 430 | 430 |
| 431 CHECK_NE(*orig, *info); | 431 CHECK_NE(*orig, *info); |
| 432 Handle<JSFunction> fun = | 432 Handle<JSFunction> fun = |
| 433 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 433 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 434 info, isolate->native_context()); | 434 info, isolate->native_context()); |
| 435 Handle<JSObject> global(isolate->context()->global_object()); | 435 Handle<JSObject> global(isolate->context()->global_object()); |
| 436 Handle<Object> result = | 436 Handle<Object> result = |
| 437 Execution::Call(isolate, fun, global, 0, NULL).ToHandleChecked(); | 437 Execution::Call(isolate, fun, global, 0, NULL).ToHandleChecked(); |
| 438 CHECK_EQ(2, Handle<Smi>::cast(result)->value()); | 438 CHECK_EQ(2, Handle<Smi>::cast(result)->value()); |
| 439 |
| 440 delete cache; |
| 439 } | 441 } |
| 440 | 442 |
| 441 | 443 |
| 442 #ifdef ENABLE_DISASSEMBLER | 444 #ifdef ENABLE_DISASSEMBLER |
| 443 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, | 445 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, |
| 444 const char* property_name) { | 446 const char* property_name) { |
| 445 v8::Local<v8::Function> fun = | 447 v8::Local<v8::Function> fun = |
| 446 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); | 448 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); |
| 447 return v8::Utils::OpenHandle(*fun); | 449 return v8::Utils::OpenHandle(*fun); |
| 448 } | 450 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 CompileRun("function f() { a = 12345678 }; f();"); | 486 CompileRun("function f() { a = 12345678 }; f();"); |
| 485 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 487 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 486 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 488 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 487 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 489 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 488 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 490 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 489 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 491 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 490 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 492 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 491 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 493 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 492 } | 494 } |
| 493 #endif | 495 #endif |
| OLD | NEW |