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

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

Issue 2097473002: [Interpreter] Add ValueOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(), 247 InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(),
248 Runtime::kInlineSubString); 248 Runtime::kInlineSubString);
249 CHECK(sub_string_helper 249 CHECK(sub_string_helper
250 .Invoke(sub_string_helper.NewObject("'foobar'"), 250 .Invoke(sub_string_helper.NewObject("'foobar'"),
251 sub_string_helper.NewObject("3"), 251 sub_string_helper.NewObject("3"),
252 sub_string_helper.NewObject("6")) 252 sub_string_helper.NewObject("6"))
253 ->SameValue(*sub_string_helper.NewObject("'bar'"))); 253 ->SameValue(*sub_string_helper.NewObject("'bar'")));
254 } 254 }
255 255
256 TEST(ValueOf) {
257 HandleAndZoneScope handles;
258 Isolate* isolate = handles.main_isolate();
259 Factory* factory = isolate->factory();
260 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
261 Runtime::kInlineValueOf);
262
263 CHECK_EQ(Smi::FromInt(1234), *helper.Invoke(helper.NewObject("1234")));
264 CHECK_EQ(Smi::FromInt(5678),
265 *helper.Invoke(helper.NewObject("new Object(5678)")));
266
267 CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true")));
268 CHECK_EQ(*factory->false_value(),
269 *helper.Invoke(helper.NewObject("new Object(false)")));
270
271 CHECK(helper.Invoke(helper.NewObject("'foobar'"))
272 ->SameValue(*helper.NewObject("'foobar'")));
273 CHECK(helper.Invoke(helper.NewObject("new Object('foobar')"))
274 ->SameValue(*helper.NewObject("'foobar'")));
275 }
276
256 } // namespace interpreter 277 } // namespace interpreter
257 } // namespace internal 278 } // namespace internal
258 } // namespace v8 279 } // 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