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

Side by Side Diff: test/cctest/interpreter/test-interpreter-intrinsics.cc

Issue 2051573002: [Interpreter] Add intrinsics called as stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix leak Created 4 years, 6 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/interpreter/interpreter-intrinsics.cc ('k') | no next file » | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/interpreter-intrinsics.h" 7 #include "src/interpreter/interpreter-intrinsics.h"
8 #include "test/cctest/interpreter/interpreter-tester.h" 8 #include "test/cctest/interpreter/interpreter-tester.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 factory->undefined_value(), 205 factory->undefined_value(),
206 handle(Smi::FromInt(50), isolate))); 206 handle(Smi::FromInt(50), isolate)));
207 CHECK_EQ( 207 CHECK_EQ(
208 Smi::FromInt(20), 208 Smi::FromInt(20),
209 *helper.Invoke( 209 *helper.Invoke(
210 helper.NewObject("(function(a, b, c) { return a + b + c; })"), 210 helper.NewObject("(function(a, b, c) { return a + b + c; })"),
211 factory->undefined_value(), handle(Smi::FromInt(10), isolate), 211 factory->undefined_value(), handle(Smi::FromInt(10), isolate),
212 handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate))); 212 handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate)));
213 } 213 }
214 214
215 TEST(IntrinsicAsStubCall) {
216 HandleAndZoneScope handles;
217 Isolate* isolate = handles.main_isolate();
218 Factory* factory = isolate->factory();
219 InvokeIntrinsicHelper to_number_helper(isolate, handles.main_zone(),
220 Runtime::kInlineToNumber);
221 CHECK_EQ(Smi::FromInt(46),
222 *to_number_helper.Invoke(to_number_helper.NewObject("'46'")));
223
224 InvokeIntrinsicHelper to_integer_helper(isolate, handles.main_zone(),
225 Runtime::kInlineToInteger);
226 CHECK_EQ(Smi::FromInt(502),
227 *to_integer_helper.Invoke(to_integer_helper.NewObject("502.67")));
228
229 InvokeIntrinsicHelper math_pow_helper(isolate, handles.main_zone(),
230 Runtime::kInlineMathPow);
231 CHECK(math_pow_helper
232 .Invoke(math_pow_helper.NewObject("3"),
233 math_pow_helper.NewObject("7"))
234 ->SameValue(Smi::FromInt(2187)));
235
236 InvokeIntrinsicHelper has_property_helper(isolate, handles.main_zone(),
237 Runtime::kInlineHasProperty);
238 CHECK_EQ(*factory->true_value(),
239 *has_property_helper.Invoke(
240 has_property_helper.NewObject("'x'"),
241 has_property_helper.NewObject("({ x: 20 })")));
242 CHECK_EQ(*factory->false_value(),
243 *has_property_helper.Invoke(
244 has_property_helper.NewObject("'y'"),
245 has_property_helper.NewObject("({ x: 20 })")));
246
247 InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(),
248 Runtime::kInlineSubString);
249 CHECK(sub_string_helper
250 .Invoke(sub_string_helper.NewObject("'foobar'"),
251 sub_string_helper.NewObject("3"),
252 sub_string_helper.NewObject("6"))
253 ->SameValue(*sub_string_helper.NewObject("'bar'")));
254 }
255
215 } // namespace interpreter 256 } // namespace interpreter
216 } // namespace internal 257 } // namespace internal
217 } // namespace v8 258 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-intrinsics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698