| OLD | NEW | 
|---|
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 339   return v8::Script::Compile(v8_str(source))->Run(); | 339   return v8::Script::Compile(v8_str(source))->Run(); | 
| 340 } | 340 } | 
| 341 | 341 | 
| 342 | 342 | 
| 343 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) { | 343 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) { | 
| 344   return v8::Script::Compile(source)->Run(); | 344   return v8::Script::Compile(source)->Run(); | 
| 345 } | 345 } | 
| 346 | 346 | 
| 347 | 347 | 
| 348 static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) { | 348 static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) { | 
|  | 349   // Compile once just to get the preparse data, then compile the second time | 
|  | 350   // using the data. | 
| 349   v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 351   v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 
| 350   v8::Local<v8::String> source_string = | 352   v8::ScriptCompiler::Source script_source(v8_str(source)); | 
| 351       v8::String::NewFromUtf8(isolate, source); | 353   v8::ScriptCompiler::Compile(isolate, &script_source, | 
| 352   v8::ScriptData* preparse = v8::ScriptData::PreCompile(source_string); | 354                               v8::ScriptCompiler::kProduceDataToCache); | 
| 353   v8::ScriptCompiler::Source script_source( | 355   return v8::ScriptCompiler::Compile(isolate, &script_source)->Run(); | 
| 354       source_string, new v8::ScriptCompiler::CachedData( |  | 
| 355                          reinterpret_cast<const uint8_t*>(preparse->Data()), |  | 
| 356                          preparse->Length())); |  | 
| 357   v8::Local<v8::Script> script = |  | 
| 358       v8::ScriptCompiler::Compile(isolate, &script_source); |  | 
| 359   v8::Local<v8::Value> result = script->Run(); |  | 
| 360   delete preparse; |  | 
| 361   return result; |  | 
| 362 } | 356 } | 
| 363 | 357 | 
| 364 | 358 | 
| 365 // Helper functions that compile and run the source with given origin. | 359 // Helper functions that compile and run the source with given origin. | 
| 366 static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source, | 360 static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source, | 
| 367                                                         const char* origin_url, | 361                                                         const char* origin_url, | 
| 368                                                         int line_number, | 362                                                         int line_number, | 
| 369                                                         int column_number) { | 363                                                         int column_number) { | 
| 370   v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 364   v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 
| 371   v8::ScriptOrigin origin(v8_str(origin_url), | 365   v8::ScriptOrigin origin(v8_str(origin_url), | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 433     CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); | 427     CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); | 
| 434     heap_profiler_->StopHeapObjectsTracking(); | 428     heap_profiler_->StopHeapObjectsTracking(); | 
| 435   } | 429   } | 
| 436 | 430 | 
| 437  private: | 431  private: | 
| 438   i::HeapProfiler* heap_profiler_; | 432   i::HeapProfiler* heap_profiler_; | 
| 439 }; | 433 }; | 
| 440 | 434 | 
| 441 | 435 | 
| 442 #endif  // ifndef CCTEST_H_ | 436 #endif  // ifndef CCTEST_H_ | 
| OLD | NEW | 
|---|