| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/interface-descriptors.h" | 5 #include "src/interface-descriptors.h" |
| 6 #include "src/isolate.h" | 6 #include "src/isolate.h" |
| 7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 | 11 |
| 12 using compiler::FunctionTester; | 12 using compiler::FunctionTester; |
| 13 using compiler::Node; | 13 using compiler::Node; |
| 14 | 14 |
| 15 class CodeStubAssemblerTester : public CodeStubAssembler { | 15 class ZoneHolder { |
| 16 public: |
| 17 explicit ZoneHolder(Isolate* isolate) : zone_(isolate->allocator()) {} |
| 18 Zone* zone() { return &zone_; } |
| 19 |
| 20 private: |
| 21 Zone zone_; |
| 22 }; |
| 23 |
| 24 // Inherit from ZoneHolder in order to create a zone that can be passed to |
| 25 // CodeStubAssembler base class constructor. |
| 26 class CodeStubAssemblerTester : private ZoneHolder, public CodeStubAssembler { |
| 16 public: | 27 public: |
| 17 // Test generating code for a stub. | 28 // Test generating code for a stub. |
| 18 CodeStubAssemblerTester(Isolate* isolate, | 29 CodeStubAssemblerTester(Isolate* isolate, |
| 19 const CallInterfaceDescriptor& descriptor) | 30 const CallInterfaceDescriptor& descriptor) |
| 20 : CodeStubAssembler(isolate, isolate->runtime_zone(), descriptor, | 31 : ZoneHolder(isolate), |
| 32 CodeStubAssembler(isolate, ZoneHolder::zone(), descriptor, |
| 21 Code::ComputeFlags(Code::STUB), "test"), | 33 Code::ComputeFlags(Code::STUB), "test"), |
| 22 scope_(isolate) {} | 34 scope_(isolate) {} |
| 23 | 35 |
| 24 // Test generating code for a JS function (e.g. builtins). | 36 // Test generating code for a JS function (e.g. builtins). |
| 25 CodeStubAssemblerTester(Isolate* isolate, int parameter_count) | 37 CodeStubAssemblerTester(Isolate* isolate, int parameter_count) |
| 26 : CodeStubAssembler(isolate, isolate->runtime_zone(), parameter_count, | 38 : ZoneHolder(isolate), |
| 39 CodeStubAssembler(isolate, ZoneHolder::zone(), parameter_count, |
| 27 Code::ComputeFlags(Code::FUNCTION), "test"), | 40 Code::ComputeFlags(Code::FUNCTION), "test"), |
| 28 scope_(isolate) {} | 41 scope_(isolate) {} |
| 29 | 42 |
| 30 private: | 43 private: |
| 31 HandleScope scope_; | 44 HandleScope scope_; |
| 32 LocalContext context_; | 45 LocalContext context_; |
| 33 }; | 46 }; |
| 34 | 47 |
| 35 TEST(SimpleSmiReturn) { | 48 TEST(SimpleSmiReturn) { |
| 36 Isolate* isolate(CcTest::InitIsolateOnce()); | 49 Isolate* isolate(CcTest::InitIsolateOnce()); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 CHECK(!m.ToInt32Constant(a, value32)); | 391 CHECK(!m.ToInt32Constant(a, value32)); |
| 379 CHECK(!m.ToInt64Constant(a, value64)); | 392 CHECK(!m.ToInt64Constant(a, value64)); |
| 380 | 393 |
| 381 a = m.UndefinedConstant(); | 394 a = m.UndefinedConstant(); |
| 382 CHECK(!m.ToInt32Constant(a, value32)); | 395 CHECK(!m.ToInt32Constant(a, value32)); |
| 383 CHECK(!m.ToInt64Constant(a, value64)); | 396 CHECK(!m.ToInt64Constant(a, value64)); |
| 384 } | 397 } |
| 385 | 398 |
| 386 } // namespace internal | 399 } // namespace internal |
| 387 } // namespace v8 | 400 } // namespace v8 |
| OLD | NEW |