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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 Handle<JSObject> global(isolate->context()->global_object()); | 52 Handle<JSObject> global(isolate->context()->global_object()); |
53 Runtime::SetObjectProperty(isolate, global, internalized_name, object, | 53 Runtime::SetObjectProperty(isolate, global, internalized_name, object, |
54 SLOPPY).Check(); | 54 SLOPPY).Check(); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 static Handle<JSFunction> Compile(const char* source) { | 58 static Handle<JSFunction> Compile(const char* source) { |
59 Isolate* isolate = CcTest::i_isolate(); | 59 Isolate* isolate = CcTest::i_isolate(); |
60 Handle<String> source_code = isolate->factory()->NewStringFromUtf8( | 60 Handle<String> source_code = isolate->factory()->NewStringFromUtf8( |
61 CStrVector(source)).ToHandleChecked(); | 61 CStrVector(source)).ToHandleChecked(); |
62 Handle<SharedFunctionInfo> shared_function = | 62 Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript( |
63 Compiler::CompileScript(source_code, | 63 source_code, Handle<String>(), 0, 0, false, |
64 Handle<String>(), | 64 Handle<Context>(isolate->native_context()), NULL, NULL, |
65 0, | 65 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE); |
66 0, | |
67 false, | |
68 Handle<Context>(isolate->native_context()), | |
69 NULL, NULL, NO_CACHED_DATA, | |
70 NOT_NATIVES_CODE); | |
71 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 66 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
72 shared_function, isolate->native_context()); | 67 shared_function, isolate->native_context()); |
73 } | 68 } |
74 | 69 |
75 | 70 |
76 static double Inc(Isolate* isolate, int x) { | 71 static double Inc(Isolate* isolate, int x) { |
77 const char* source = "result = %d + 1;"; | 72 const char* source = "result = %d + 1;"; |
78 EmbeddedVector<char, 512> buffer; | 73 EmbeddedVector<char, 512> buffer; |
79 SNPrintF(buffer, source, x); | 74 SNPrintF(buffer, source, x); |
80 | 75 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 CompileRun("function f() { a = 12345678 }; f();"); | 439 CompileRun("function f() { a = 12345678 }; f();"); |
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 440 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
446 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 441 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
447 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 442 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
448 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 443 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
449 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 444 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
450 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 445 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
451 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 446 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
452 } | 447 } |
453 #endif | 448 #endif |
OLD | NEW |