| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <cstring> | 5 #include <cstring> |
| 6 #include <fstream> | 6 #include <fstream> |
| 7 #include <memory> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "test/cctest/interpreter/bytecode-expectations-printer.h" | 10 #include "test/cctest/interpreter/bytecode-expectations-printer.h" |
| 10 | 11 |
| 11 #include "include/libplatform/libplatform.h" | 12 #include "include/libplatform/libplatform.h" |
| 12 #include "include/v8.h" | 13 #include "include/v8.h" |
| 13 | 14 |
| 14 #include "src/base/logging.h" | 15 #include "src/base/logging.h" |
| 15 #include "src/base/smart-pointers.h" | |
| 16 #include "src/compiler.h" | 16 #include "src/compiler.h" |
| 17 #include "src/interpreter/interpreter.h" | 17 #include "src/interpreter/interpreter.h" |
| 18 | 18 |
| 19 #ifdef V8_OS_POSIX | 19 #ifdef V8_OS_POSIX |
| 20 #include <dirent.h> | 20 #include <dirent.h> |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 using v8::internal::interpreter::BytecodeExpectationsPrinter; | 23 using v8::internal::interpreter::BytecodeExpectationsPrinter; |
| 24 | 24 |
| 25 #define REPORT_ERROR(MESSAGE) (((std::cerr << "ERROR: ") << MESSAGE) << '\n') | 25 #define REPORT_ERROR(MESSAGE) (((std::cerr << "ERROR: ") << MESSAGE) << '\n') |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 class V8InitializationScope final { | 96 class V8InitializationScope final { |
| 97 public: | 97 public: |
| 98 explicit V8InitializationScope(const char* exec_path); | 98 explicit V8InitializationScope(const char* exec_path); |
| 99 ~V8InitializationScope(); | 99 ~V8InitializationScope(); |
| 100 | 100 |
| 101 v8::Platform* platform() const { return platform_.get(); } | 101 v8::Platform* platform() const { return platform_.get(); } |
| 102 v8::Isolate* isolate() const { return isolate_; } | 102 v8::Isolate* isolate() const { return isolate_; } |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 v8::base::SmartPointer<v8::Platform> platform_; | 105 std::unique_ptr<v8::Platform> platform_; |
| 106 v8::base::SmartPointer<v8::ArrayBuffer::Allocator> allocator_; | 106 std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_; |
| 107 v8::Isolate* isolate_; | 107 v8::Isolate* isolate_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(V8InitializationScope); | 109 DISALLOW_COPY_AND_ASSIGN(V8InitializationScope); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 BytecodeExpectationsPrinter::ConstantPoolType ParseConstantPoolType( | 112 BytecodeExpectationsPrinter::ConstantPoolType ParseConstantPoolType( |
| 113 const char* type_string) { | 113 const char* type_string) { |
| 114 if (strcmp(type_string, "number") == 0) { | 114 if (strcmp(type_string, "number") == 0) { |
| 115 return BytecodeExpectationsPrinter::ConstantPoolType::kNumber; | 115 return BytecodeExpectationsPrinter::ConstantPoolType::kNumber; |
| 116 } else if (strcmp(type_string, "string") == 0) { | 116 } else if (strcmp(type_string, "string") == 0) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 i::FLAG_ignition = true; | 347 i::FLAG_ignition = true; |
| 348 i::FLAG_always_opt = false; | 348 i::FLAG_always_opt = false; |
| 349 i::FLAG_allow_natives_syntax = true; | 349 i::FLAG_allow_natives_syntax = true; |
| 350 | 350 |
| 351 v8::V8::InitializeICUDefaultLocation(exec_path); | 351 v8::V8::InitializeICUDefaultLocation(exec_path); |
| 352 v8::V8::InitializeExternalStartupData(exec_path); | 352 v8::V8::InitializeExternalStartupData(exec_path); |
| 353 v8::V8::InitializePlatform(platform_.get()); | 353 v8::V8::InitializePlatform(platform_.get()); |
| 354 v8::V8::Initialize(); | 354 v8::V8::Initialize(); |
| 355 | 355 |
| 356 v8::Isolate::CreateParams create_params; | 356 v8::Isolate::CreateParams create_params; |
| 357 allocator_.Reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator()); | 357 allocator_.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator()); |
| 358 create_params.array_buffer_allocator = allocator_.get(); | 358 create_params.array_buffer_allocator = allocator_.get(); |
| 359 | 359 |
| 360 isolate_ = v8::Isolate::New(create_params); | 360 isolate_ = v8::Isolate::New(create_params); |
| 361 } | 361 } |
| 362 | 362 |
| 363 V8InitializationScope::~V8InitializationScope() { | 363 V8InitializationScope::~V8InitializationScope() { |
| 364 isolate_->Dispose(); | 364 isolate_->Dispose(); |
| 365 v8::V8::Dispose(); | 365 v8::V8::Dispose(); |
| 366 v8::V8::ShutdownPlatform(); | 366 v8::V8::ShutdownPlatform(); |
| 367 } | 367 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 if (!options.rebaseline()) { | 568 if (!options.rebaseline()) { |
| 569 if (!WriteExpectationsFile(snippet_list, platform, options, | 569 if (!WriteExpectationsFile(snippet_list, platform, options, |
| 570 options.output_filename())) { | 570 options.output_filename())) { |
| 571 return 3; | 571 return 3; |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 } | 574 } |
| OLD | NEW |