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

Side by Side Diff: test/unittests/compiler/interpreter-assembler-unittest.cc

Issue 1333843002: [runtime] Move binary operator fallbacks into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
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 "test/unittests/compiler/interpreter-assembler-unittest.h" 5 #include "test/unittests/compiler/interpreter-assembler-unittest.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/interface-descriptors.h" 9 #include "src/interface-descriptors.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 InterpreterAssemblerForTest m(this, bytecode); 320 InterpreterAssemblerForTest m(this, bytecode);
321 Node* object = m.IntPtrConstant(0xdeadbeef); 321 Node* object = m.IntPtrConstant(0xdeadbeef);
322 int offset = 16; 322 int offset = 16;
323 Node* load_field = m.LoadObjectField(object, offset); 323 Node* load_field = m.LoadObjectField(object, offset);
324 EXPECT_THAT(load_field, 324 EXPECT_THAT(load_field,
325 m.IsLoad(kMachAnyTagged, object, 325 m.IsLoad(kMachAnyTagged, object,
326 IsIntPtrConstant(offset - kHeapObjectTag))); 326 IsIntPtrConstant(offset - kHeapObjectTag)));
327 } 327 }
328 } 328 }
329 329
330 330
rmcilroy 2015/09/10 10:28:25 Please add a CallRuntime test here
Benedikt Meurer 2015/09/10 10:55:49 Done.
331 TARGET_TEST_F(InterpreterAssemblerTest, CallJSBuiltin) {
332 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
333 InterpreterAssemblerForTest m(this, bytecode);
334 Node* receiver = m.IntPtrConstant(1234);
335 Node* call_js_builtin_0 =
336 m.CallJSBuiltin(Context::SUB_BUILTIN_INDEX, receiver);
337
338 Matcher<Node*> load_globals_matcher = m.IsLoad(
339 kMachAnyTagged, IsParameter(Linkage::kInterpreterContextParameter),
340 IsIntPtrConstant(Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
341 Matcher<Node*> load_native_context_matcher = m.IsLoad(
342 kMachAnyTagged, load_globals_matcher,
343 IsIntPtrConstant(GlobalObject::kNativeContextOffset - kHeapObjectTag));
344 Matcher<Node*> function_matcher = m.IsLoad(
345 kMachAnyTagged, load_native_context_matcher,
346 IsIntPtrConstant(Context::SlotOffset(Context::SUB_BUILTIN_INDEX)));
347 Matcher<Node*> context_matcher =
348 m.IsLoad(kMachAnyTagged, function_matcher,
349 IsIntPtrConstant(JSFunction::kContextOffset - kHeapObjectTag));
350 EXPECT_THAT(call_js_builtin_0,
351 m.IsCall(_, function_matcher, receiver, context_matcher));
352
353 Node* arg1 = m.Int32Constant(0xabcd);
354 Node* call_js_builtin_1 =
355 m.CallJSBuiltin(Context::SUB_BUILTIN_INDEX, receiver, arg1);
356 EXPECT_THAT(call_js_builtin_1,
357 m.IsCall(_, function_matcher, receiver, arg1, context_matcher));
358 }
359 }
360
361
362 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { 331 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
363 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 332 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
364 InterpreterAssemblerForTest m(this, bytecode); 333 InterpreterAssemblerForTest m(this, bytecode);
365 LoadWithVectorDescriptor descriptor(isolate()); 334 LoadWithVectorDescriptor descriptor(isolate());
366 Node* target = m.Int32Constant(1); 335 Node* target = m.Int32Constant(1);
367 Node* arg1 = m.Int32Constant(2); 336 Node* arg1 = m.Int32Constant(2);
368 Node* arg2 = m.Int32Constant(3); 337 Node* arg2 = m.Int32Constant(3);
369 Node* arg3 = m.Int32Constant(4); 338 Node* arg3 = m.Int32Constant(4);
370 Node* arg4 = m.Int32Constant(5); 339 Node* arg4 = m.Int32Constant(5);
371 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); 340 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
(...skipping 22 matching lines...) Expand all
394 feedback_vector, 363 feedback_vector,
395 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 364 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
396 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 365 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
397 kHeapObjectTag))); 366 kHeapObjectTag)));
398 } 367 }
399 } 368 }
400 369
401 } // namespace compiler 370 } // namespace compiler
402 } // namespace internal 371 } // namespace internal
403 } // namespace v8 372 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698