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

Side by Side Diff: runtime/vm/code_generator_x64.cc

Issue 9395016: First part of new ICData infrastructure: use a wrapper object instead of an array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/ast_printer.h" 11 #include "vm/ast_printer.h"
12 #include "vm/class_finalizer.h" 12 #include "vm/class_finalizer.h"
13 #include "vm/dart_entry.h" 13 #include "vm/dart_entry.h"
14 #include "vm/debugger.h" 14 #include "vm/debugger.h"
15 #include "vm/ic_data.h"
16 #include "vm/longjump.h" 15 #include "vm/longjump.h"
17 #include "vm/object.h" 16 #include "vm/object.h"
18 #include "vm/object_store.h" 17 #include "vm/object_store.h"
19 #include "vm/parser.h" 18 #include "vm/parser.h"
20 #include "vm/resolver.h" 19 #include "vm/resolver.h"
21 #include "vm/stub_code.h" 20 #include "vm/stub_code.h"
22 21
23 namespace dart { 22 namespace dart {
24 23
25 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); 24 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree.");
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 intptr_t node_id, 441 intptr_t node_id,
443 intptr_t token_index, 442 intptr_t token_index,
444 const String& function_name, 443 const String& function_name,
445 int num_arguments, 444 int num_arguments,
446 const Array& optional_arguments_names, 445 const Array& optional_arguments_names,
447 intptr_t num_args_checked) { 446 intptr_t num_args_checked) {
448 ASSERT(num_args_checked > 0); // At least receiver check is necessary. 447 ASSERT(num_args_checked > 0); // At least receiver check is necessary.
449 // Set up the function name and number of arguments (including the receiver) 448 // Set up the function name and number of arguments (including the receiver)
450 // to the InstanceCall stub which will resolve the correct entrypoint for 449 // to the InstanceCall stub which will resolve the correct entrypoint for
451 // the operator and call it. 450 // the operator and call it.
452 ICData ic_data(function_name, num_args_checked); 451 ICData& ic_data = ICData::ZoneHandle();
453 __ LoadObject(RBX, Array::ZoneHandle(ic_data.data())); 452 ic_data = ICData::New(parsed_function().function(),
453 function_name,
454 node_id,
455 num_args_checked);
456 __ LoadObject(RBX, ic_data);
454 __ LoadObject(R10, ArgumentsDescriptor(num_arguments, 457 __ LoadObject(R10, ArgumentsDescriptor(num_arguments,
455 optional_arguments_names)); 458 optional_arguments_names));
456 uword label_address = 0; 459 uword label_address = 0;
457 switch (num_args_checked) { 460 switch (num_args_checked) {
458 case 1: 461 case 1:
459 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); 462 label_address = StubCode::OneArgCheckInlineCacheEntryPoint();
460 break; 463 break;
461 case 2: 464 case 2:
462 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint(); 465 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint();
463 break; 466 break;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 __ cmpq(Address(RDI, 0), raw_null); 685 __ cmpq(Address(RDI, 0), raw_null);
683 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); 686 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
684 687
685 __ Bind(&wrong_num_arguments); 688 __ Bind(&wrong_num_arguments);
686 if (function.IsClosureFunction()) { 689 if (function.IsClosureFunction()) {
687 GenerateCallRuntime(AstNode::kNoId, 690 GenerateCallRuntime(AstNode::kNoId,
688 function.token_index(), 691 function.token_index(),
689 kClosureArgumentMismatchRuntimeEntry); 692 kClosureArgumentMismatchRuntimeEntry);
690 } else { 693 } else {
691 // Invoke noSuchMethod function. 694 // Invoke noSuchMethod function.
692 ICData ic_data(String::Handle(function.name()), 1); 695 const int kNumArgsChecked = 1;
693 __ LoadObject(RBX, Array::ZoneHandle(ic_data.data())); 696 ICData& ic_data = ICData::ZoneHandle();
697 ic_data = ICData::New(parsed_function().function(),
698 String::Handle(function.name()),
699 AstNode::kNoId,
700 kNumArgsChecked);
701 __ LoadObject(RBX, ic_data);
694 // RBP : points to previous frame pointer. 702 // RBP : points to previous frame pointer.
695 // RBP + 8 : points to return address. 703 // RBP + 8 : points to return address.
696 // RBP + 16 : address of last argument (arg n-1). 704 // RBP + 16 : address of last argument (arg n-1).
697 // RSP + 16 + 8*(n-1) : address of first argument (arg 0). 705 // RSP + 16 + 8*(n-1) : address of first argument (arg 0).
698 // RBX : ic-data array. 706 // RBX : ic-data array.
regis 2012/02/21 21:51:34 Remove "array" in comment?
srdjan 2012/02/22 14:59:45 Done.
699 // R10 : arguments descriptor array. 707 // R10 : arguments descriptor array.
700 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); 708 __ call(&StubCode::CallNoSuchMethodFunctionLabel());
701 } 709 }
702 710
703 if (FLAG_trace_functions) { 711 if (FLAG_trace_functions) {
704 __ pushq(RAX); // Preserve result. 712 __ pushq(RAX); // Preserve result.
705 __ PushObject(function); 713 __ PushObject(function);
706 GenerateCallRuntime(AstNode::kNoId, 714 GenerateCallRuntime(AstNode::kNoId,
707 0, 715 0,
708 kTraceFunctionExitRuntimeEntry); 716 kTraceFunctionExitRuntimeEntry);
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 const Error& error = Error::Handle( 2813 const Error& error = Error::Handle(
2806 Parser::FormatError(script, token_index, "Error", format, args)); 2814 Parser::FormatError(script, token_index, "Error", format, args));
2807 va_end(args); 2815 va_end(args);
2808 Isolate::Current()->long_jump_base()->Jump(1, error); 2816 Isolate::Current()->long_jump_base()->Jump(1, error);
2809 UNREACHABLE(); 2817 UNREACHABLE();
2810 } 2818 }
2811 2819
2812 } // namespace dart 2820 } // namespace dart
2813 2821
2814 #endif // defined TARGET_ARCH_X64 2822 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698