| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 const char* error_source = "var x = y z;"; | 199 const char* error_source = "var x = y z;"; |
| 200 int error_source_length = i::StrLength(error_source); | 200 int error_source_length = i::StrLength(error_source); |
| 201 | 201 |
| 202 v8::ScriptData* preparse = | 202 v8::ScriptData* preparse = |
| 203 v8::ScriptData::PreCompile(isolate, source, source_length); | 203 v8::ScriptData::PreCompile(isolate, source, source_length); |
| 204 CHECK(!preparse->HasError()); | 204 CHECK(!preparse->HasError()); |
| 205 bool lazy_flag = i::FLAG_lazy; | 205 bool lazy_flag = i::FLAG_lazy; |
| 206 { | 206 { |
| 207 i::FLAG_lazy = true; | 207 i::FLAG_lazy = true; |
| 208 ScriptResource* resource = new ScriptResource(source, source_length); | 208 ScriptResource* resource = new ScriptResource(source, source_length); |
| 209 v8::Local<v8::String> script_source = v8::String::NewExternal(resource); | 209 v8::Local<v8::String> script_source = |
| 210 v8::String::NewExternal(isolate, resource); |
| 210 v8::Script::Compile(script_source, NULL, preparse); | 211 v8::Script::Compile(script_source, NULL, preparse); |
| 211 } | 212 } |
| 212 | 213 |
| 213 { | 214 { |
| 214 i::FLAG_lazy = false; | 215 i::FLAG_lazy = false; |
| 215 | 216 |
| 216 ScriptResource* resource = new ScriptResource(source, source_length); | 217 ScriptResource* resource = new ScriptResource(source, source_length); |
| 217 v8::Local<v8::String> script_source = v8::String::NewExternal(resource); | 218 v8::Local<v8::String> script_source = |
| 219 v8::String::NewExternal(isolate, resource); |
| 218 v8::Script::New(script_source, NULL, preparse, v8::Local<v8::String>()); | 220 v8::Script::New(script_source, NULL, preparse, v8::Local<v8::String>()); |
| 219 } | 221 } |
| 220 delete preparse; | 222 delete preparse; |
| 221 i::FLAG_lazy = lazy_flag; | 223 i::FLAG_lazy = lazy_flag; |
| 222 | 224 |
| 223 // Syntax error. | 225 // Syntax error. |
| 224 v8::ScriptData* error_preparse = | 226 v8::ScriptData* error_preparse = |
| 225 v8::ScriptData::PreCompile(isolate, error_source, error_source_length); | 227 v8::ScriptData::PreCompile(isolate, error_source, error_source_length); |
| 226 CHECK(error_preparse->HasError()); | 228 CHECK(error_preparse->HasError()); |
| 227 i::ScriptDataImpl *pre_impl = | 229 i::ScriptDataImpl *pre_impl = |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 " b = function() { \n" | 1329 " b = function() { \n" |
| 1328 " 01; \n" | 1330 " 01; \n" |
| 1329 " }; \n" | 1331 " }; \n" |
| 1330 "}; \n"; | 1332 "}; \n"; |
| 1331 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); | 1333 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); |
| 1332 CHECK(try_catch.HasCaught()); | 1334 CHECK(try_catch.HasCaught()); |
| 1333 v8::String::Utf8Value exception(try_catch.Exception()); | 1335 v8::String::Utf8Value exception(try_catch.Exception()); |
| 1334 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1336 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
| 1335 *exception); | 1337 *exception); |
| 1336 } | 1338 } |
| OLD | NEW |