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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, | 97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, |
98 kNonStrictMode); | 98 kNonStrictMode); |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 static Handle<JSFunction> Compile(const char* source) { | 102 static Handle<JSFunction> Compile(const char* source) { |
103 Isolate* isolate = CcTest::i_isolate(); | 103 Isolate* isolate = CcTest::i_isolate(); |
104 Handle<String> source_code( | 104 Handle<String> source_code( |
105 isolate->factory()->NewStringFromUtf8(CStrVector(source))); | 105 isolate->factory()->NewStringFromUtf8(CStrVector(source))); |
106 Handle<SharedFunctionInfo> shared_function = | 106 Handle<SharedFunctionInfo> shared_function = |
107 Compiler::Compile(source_code, | 107 Compiler::CompileScript(source_code, |
108 Handle<String>(), | 108 Handle<String>(), |
109 0, | 109 0, |
110 0, | 110 0, |
111 false, | 111 false, |
112 Handle<Context>(isolate->native_context()), | 112 Handle<Context>(isolate->native_context()), |
113 NULL, | 113 NULL, NULL, |
114 NULL, | 114 Handle<String>::null(), |
115 Handle<String>::null(), | 115 NOT_NATIVES_CODE); |
116 NOT_NATIVES_CODE); | |
117 return isolate->factory()->NewFunctionFromSharedFunctionInfo( | 116 return isolate->factory()->NewFunctionFromSharedFunctionInfo( |
118 shared_function, isolate->native_context()); | 117 shared_function, isolate->native_context()); |
119 } | 118 } |
120 | 119 |
121 | 120 |
122 static double Inc(Isolate* isolate, int x) { | 121 static double Inc(Isolate* isolate, int x) { |
123 const char* source = "result = %d + 1;"; | 122 const char* source = "result = %d + 1;"; |
124 EmbeddedVector<char, 512> buffer; | 123 EmbeddedVector<char, 512> buffer; |
125 OS::SNPrintF(buffer, source, x); | 124 OS::SNPrintF(buffer, source, x); |
126 | 125 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 CompileRun("function f() { a = 12345678 }; f();"); | 437 CompileRun("function f() { a = 12345678 }; f();"); |
439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 438 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 439 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 440 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 441 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 442 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 443 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 444 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
446 } | 445 } |
447 #endif | 446 #endif |
OLD | NEW |