Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: test/cctest/compiler/test-code-stub-assembler.cc

Issue 1824993002: [builtins] Add support for JS builtins written in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | test/mjsunit/compiler/deopt-materialize-accumulator.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 CHECK_EQ(0.5, Handle<HeapNumber>::cast(result.ToHandleChecked())->value()); 69 CHECK_EQ(0.5, Handle<HeapNumber>::cast(result.ToHandleChecked())->value());
70 } 70 }
71 71
72 72
73 TEST(SimpleCallRuntime1Arg) { 73 TEST(SimpleCallRuntime1Arg) {
74 Isolate* isolate(CcTest::InitIsolateOnce()); 74 Isolate* isolate(CcTest::InitIsolateOnce());
75 VoidDescriptor descriptor(isolate); 75 VoidDescriptor descriptor(isolate);
76 CodeStubAssemblerTester m(isolate, descriptor); 76 CodeStubAssemblerTester m(isolate, descriptor);
77 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); 77 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context()));
78 Node* b = m.SmiTag(m.Int32Constant(256)); 78 Node* b = m.SmiTag(m.Int32Constant(256));
79 m.Return(m.CallRuntime(Runtime::kMathSqrt, context, b)); 79 m.Return(m.CallRuntime(Runtime::kMathFloor, context, b));
80 Handle<Code> code = m.GenerateCode(); 80 Handle<Code> code = m.GenerateCode();
81 FunctionTester ft(descriptor, code); 81 FunctionTester ft(descriptor, code);
82 MaybeHandle<Object> result = ft.Call(); 82 MaybeHandle<Object> result = ft.Call();
83 CHECK_EQ(16, Handle<Smi>::cast(result.ToHandleChecked())->value()); 83 CHECK_EQ(256, Handle<Smi>::cast(result.ToHandleChecked())->value());
84 } 84 }
85 85
86 86
87 TEST(SimpleTailCallRuntime1Arg) { 87 TEST(SimpleTailCallRuntime1Arg) {
88 Isolate* isolate(CcTest::InitIsolateOnce()); 88 Isolate* isolate(CcTest::InitIsolateOnce());
89 VoidDescriptor descriptor(isolate); 89 VoidDescriptor descriptor(isolate);
90 CodeStubAssemblerTester m(isolate, descriptor); 90 CodeStubAssemblerTester m(isolate, descriptor);
91 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); 91 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context()));
92 Node* b = m.SmiTag(m.Int32Constant(256)); 92 Node* b = m.SmiTag(m.Int32Constant(256));
93 m.TailCallRuntime(Runtime::kMathSqrt, context, b); 93 m.TailCallRuntime(Runtime::kMathFloor, context, b);
94 Handle<Code> code = m.GenerateCode(); 94 Handle<Code> code = m.GenerateCode();
95 FunctionTester ft(descriptor, code); 95 FunctionTester ft(descriptor, code);
96 MaybeHandle<Object> result = ft.Call(); 96 MaybeHandle<Object> result = ft.Call();
97 CHECK_EQ(16, Handle<Smi>::cast(result.ToHandleChecked())->value()); 97 CHECK_EQ(256, Handle<Smi>::cast(result.ToHandleChecked())->value());
98 } 98 }
99 99
100 100
101 TEST(SimpleCallRuntime2Arg) { 101 TEST(SimpleCallRuntime2Arg) {
102 Isolate* isolate(CcTest::InitIsolateOnce()); 102 Isolate* isolate(CcTest::InitIsolateOnce());
103 VoidDescriptor descriptor(isolate); 103 VoidDescriptor descriptor(isolate);
104 CodeStubAssemblerTester m(isolate, descriptor); 104 CodeStubAssemblerTester m(isolate, descriptor);
105 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); 105 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context()));
106 Node* a = m.SmiTag(m.Int32Constant(2)); 106 Node* a = m.SmiTag(m.Int32Constant(2));
107 Node* b = m.SmiTag(m.Int32Constant(4)); 107 Node* b = m.SmiTag(m.Int32Constant(4));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 Handle<Smi>(Smi::FromInt(34), isolate)}; 327 Handle<Smi>(Smi::FromInt(34), isolate)};
328 MaybeHandle<Object> result = 328 MaybeHandle<Object> result =
329 Execution::Call(isolate, function, isolate->factory()->undefined_value(), 329 Execution::Call(isolate, function, isolate->factory()->undefined_value(),
330 arraysize(args), args); 330 arraysize(args), args);
331 CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); 331 CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value());
332 } 332 }
333 333
334 } // namespace compiler 334 } // namespace compiler
335 } // namespace internal 335 } // namespace internal
336 } // namespace v8 336 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | test/mjsunit/compiler/deopt-materialize-accumulator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698