| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 206   const char* error_source = "var x = y z;"; | 206   const char* error_source = "var x = y z;"; | 
| 207   int error_source_length = i::StrLength(error_source); | 207   int error_source_length = i::StrLength(error_source); | 
| 208 | 208 | 
| 209   v8::ScriptData* preparse = v8::ScriptData::PreCompile(v8::String::NewFromUtf8( | 209   v8::ScriptData* preparse = v8::ScriptData::PreCompile(v8::String::NewFromUtf8( | 
| 210       isolate, source, v8::String::kNormalString, source_length)); | 210       isolate, source, v8::String::kNormalString, source_length)); | 
| 211   CHECK(!preparse->HasError()); | 211   CHECK(!preparse->HasError()); | 
| 212   bool lazy_flag = i::FLAG_lazy; | 212   bool lazy_flag = i::FLAG_lazy; | 
| 213   { | 213   { | 
| 214     i::FLAG_lazy = true; | 214     i::FLAG_lazy = true; | 
| 215     ScriptResource* resource = new ScriptResource(source, source_length); | 215     ScriptResource* resource = new ScriptResource(source, source_length); | 
| 216     v8::Local<v8::String> script_source = | 216     v8::ScriptCompiler::Source script_source( | 
| 217         v8::String::NewExternal(isolate, resource); | 217         v8::String::NewExternal(isolate, resource), | 
| 218     v8::Script::Compile(script_source, NULL, preparse); | 218         v8::ScriptCompiler::CachedData( | 
|  | 219             reinterpret_cast<const uint8_t*>(preparse->Data()), | 
|  | 220             preparse->Length())); | 
|  | 221     v8::ScriptCompiler::Compile(isolate, | 
|  | 222                                 v8::ScriptCompiler::Source(script_source)); | 
| 219   } | 223   } | 
| 220 | 224 | 
| 221   { | 225   { | 
| 222     i::FLAG_lazy = false; | 226     i::FLAG_lazy = false; | 
| 223 | 227 | 
| 224     ScriptResource* resource = new ScriptResource(source, source_length); | 228     ScriptResource* resource = new ScriptResource(source, source_length); | 
| 225     v8::Local<v8::String> script_source = | 229     v8::ScriptCompiler::Source script_source( | 
| 226         v8::String::NewExternal(isolate, resource); | 230         v8::String::NewExternal(isolate, resource), | 
| 227     v8::Script::New(script_source, NULL, preparse); | 231         v8::ScriptCompiler::CachedData( | 
|  | 232             reinterpret_cast<const uint8_t*>(preparse->Data()), | 
|  | 233             preparse->Length())); | 
|  | 234     v8::ScriptCompiler::CompileUnbound(isolate, script_source); | 
| 228   } | 235   } | 
| 229   delete preparse; | 236   delete preparse; | 
| 230   i::FLAG_lazy = lazy_flag; | 237   i::FLAG_lazy = lazy_flag; | 
| 231 | 238 | 
| 232   // Syntax error. | 239   // Syntax error. | 
| 233   v8::ScriptData* error_preparse = v8::ScriptData::PreCompile( | 240   v8::ScriptData* error_preparse = v8::ScriptData::PreCompile( | 
| 234       v8::String::NewFromUtf8(isolate, | 241       v8::String::NewFromUtf8(isolate, | 
| 235                               error_source, | 242                               error_source, | 
| 236                               v8::String::kNormalString, | 243                               v8::String::kNormalString, | 
| 237                               error_source_length)); | 244                               error_source_length)); | 
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2349 | 2356 | 
| 2350   const char* statement_data[] = { | 2357   const char* statement_data[] = { | 
| 2351     statement, | 2358     statement, | 
| 2352     NULL | 2359     NULL | 
| 2353   }; | 2360   }; | 
| 2354 | 2361 | 
| 2355   // The test is quite slow, so run it with a reduced set of flags. | 2362   // The test is quite slow, so run it with a reduced set of flags. | 
| 2356   static const ParserFlag empty_flags[] = {kAllowLazy}; | 2363   static const ParserFlag empty_flags[] = {kAllowLazy}; | 
| 2357   RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); | 2364   RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); | 
| 2358 } | 2365 } | 
| OLD | NEW | 
|---|