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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 Handle<String> internalized_name = | 49 Handle<String> internalized_name = |
50 isolate->factory()->InternalizeUtf8String(name); | 50 isolate->factory()->InternalizeUtf8String(name); |
51 Handle<JSObject> global(isolate->context()->global_object()); | 51 Handle<JSObject> global(isolate->context()->global_object()); |
52 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, | 52 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, |
53 SLOPPY).Check(); | 53 SLOPPY).Check(); |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 static Handle<JSFunction> Compile(const char* source) { | 57 static Handle<JSFunction> Compile(const char* source) { |
58 Isolate* isolate = CcTest::i_isolate(); | 58 Isolate* isolate = CcTest::i_isolate(); |
59 Handle<String> source_code( | 59 Handle<String> source_code = isolate->factory()->NewStringFromUtf8( |
60 isolate->factory()->NewStringFromUtf8(CStrVector(source))); | 60 CStrVector(source)).ToHandleChecked(); |
61 Handle<SharedFunctionInfo> shared_function = | 61 Handle<SharedFunctionInfo> shared_function = |
62 Compiler::CompileScript(source_code, | 62 Compiler::CompileScript(source_code, |
63 Handle<String>(), | 63 Handle<String>(), |
64 0, | 64 0, |
65 0, | 65 0, |
66 false, | 66 false, |
67 Handle<Context>(isolate->native_context()), | 67 Handle<Context>(isolate->native_context()), |
68 NULL, NULL, NO_CACHED_DATA, | 68 NULL, NULL, NO_CACHED_DATA, |
69 NOT_NATIVES_CODE); | 69 NOT_NATIVES_CODE); |
70 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 70 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 CompileRun("function f() { a = 12345678 }; f();"); | 371 CompileRun("function f() { a = 12345678 }; f();"); |
372 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 372 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
373 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 373 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
375 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 375 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
377 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 377 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
379 } | 379 } |
380 #endif | 380 #endif |
OLD | NEW |