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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 const char* error_source = "var x = y z;"; | 205 const char* error_source = "var x = y z;"; |
206 int error_source_length = i::StrLength(error_source); | 206 int error_source_length = i::StrLength(error_source); |
207 | 207 |
208 v8::ScriptData* preparse = v8::ScriptData::PreCompile(v8::String::NewFromUtf8( | 208 v8::ScriptData* preparse = v8::ScriptData::PreCompile(v8::String::NewFromUtf8( |
209 isolate, source, v8::String::kNormalString, source_length)); | 209 isolate, source, v8::String::kNormalString, source_length)); |
210 CHECK(!preparse->HasError()); | 210 CHECK(!preparse->HasError()); |
211 bool lazy_flag = i::FLAG_lazy; | 211 bool lazy_flag = i::FLAG_lazy; |
212 { | 212 { |
213 i::FLAG_lazy = true; | 213 i::FLAG_lazy = true; |
214 ScriptResource* resource = new ScriptResource(source, source_length); | 214 ScriptResource* resource = new ScriptResource(source, source_length); |
215 v8::Local<v8::String> script_source = | 215 v8::ScriptCompiler::Source script_source( |
216 v8::String::NewExternal(isolate, resource); | 216 v8::String::NewExternal(isolate, resource), |
217 v8::Script::Compile(script_source, NULL, preparse); | 217 v8::ScriptCompiler::CachedData( |
| 218 reinterpret_cast<const uint8_t*>(preparse->Data()), |
| 219 preparse->Length())); |
| 220 v8::ScriptCompiler::CompileContextBound( |
| 221 isolate, v8::ScriptCompiler::Source(script_source)); |
218 } | 222 } |
219 | 223 |
220 { | 224 { |
221 i::FLAG_lazy = false; | 225 i::FLAG_lazy = false; |
222 | 226 |
223 ScriptResource* resource = new ScriptResource(source, source_length); | 227 ScriptResource* resource = new ScriptResource(source, source_length); |
224 v8::Local<v8::String> script_source = | 228 v8::ScriptCompiler::Source script_source( |
225 v8::String::NewExternal(isolate, resource); | 229 v8::String::NewExternal(isolate, resource), |
226 v8::Script::New(script_source, NULL, preparse); | 230 v8::ScriptCompiler::CachedData( |
| 231 reinterpret_cast<const uint8_t*>(preparse->Data()), |
| 232 preparse->Length())); |
| 233 v8::ScriptCompiler::CompileContextUnbound(isolate, script_source); |
227 } | 234 } |
228 delete preparse; | 235 delete preparse; |
229 i::FLAG_lazy = lazy_flag; | 236 i::FLAG_lazy = lazy_flag; |
230 | 237 |
231 // Syntax error. | 238 // Syntax error. |
232 v8::ScriptData* error_preparse = v8::ScriptData::PreCompile( | 239 v8::ScriptData* error_preparse = v8::ScriptData::PreCompile( |
233 v8::String::NewFromUtf8(isolate, | 240 v8::String::NewFromUtf8(isolate, |
234 error_source, | 241 error_source, |
235 v8::String::kNormalString, | 242 v8::String::kNormalString, |
236 error_source_length)); | 243 error_source_length)); |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 "if: 4", | 2318 "if: 4", |
2312 "interface: 5", | 2319 "interface: 5", |
2313 "super: 6", | 2320 "super: 6", |
2314 "eval: 7", | 2321 "eval: 7", |
2315 "arguments: 8", | 2322 "arguments: 8", |
2316 NULL | 2323 NULL |
2317 }; | 2324 }; |
2318 | 2325 |
2319 RunParserSyncTest(context_data, statement_data, kSuccess); | 2326 RunParserSyncTest(context_data, statement_data, kSuccess); |
2320 } | 2327 } |
OLD | NEW |