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

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

Issue 8992020: First part of inspecting local variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 void CodeGenerator::FinalizePcDescriptors(const Code& code) { 346 void CodeGenerator::FinalizePcDescriptors(const Code& code) {
347 ASSERT(pc_descriptors_list_ != NULL); 347 ASSERT(pc_descriptors_list_ != NULL);
348 const PcDescriptors& descriptors = PcDescriptors::Handle( 348 const PcDescriptors& descriptors = PcDescriptors::Handle(
349 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint())); 349 pc_descriptors_list_->FinalizePcDescriptors(code.EntryPoint()));
350 VerifyPcDescriptors( 350 VerifyPcDescriptors(
351 descriptors, parsed_function_.function().is_optimizable()); 351 descriptors, parsed_function_.function().is_optimizable());
352 code.set_pc_descriptors(descriptors); 352 code.set_pc_descriptors(descriptors);
353 } 353 }
354 354
355 355
356 void CodeGenerator::FinalizeVarDescriptors(const Code& code) {
357 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(
358 parsed_function_.node_sequence()->scope()->GetVarDescriptors());
359 code.set_var_descriptors(var_descs);
360 }
361
362
356 void CodeGenerator::FinalizeExceptionHandlers(const Code& code) { 363 void CodeGenerator::FinalizeExceptionHandlers(const Code& code) {
357 ASSERT(exception_handlers_list_ != NULL); 364 ASSERT(exception_handlers_list_ != NULL);
358 const ExceptionHandlers& handlers = ExceptionHandlers::Handle( 365 const ExceptionHandlers& handlers = ExceptionHandlers::Handle(
359 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint())); 366 exception_handlers_list_->FinalizeExceptionHandlers(code.EntryPoint()));
360 code.set_exception_handlers(handlers); 367 code.set_exception_handlers(handlers);
361 } 368 }
362 369
363 370
364 void CodeGenerator::GenerateLoadVariable(Register dst, 371 void CodeGenerator::GenerateLoadVariable(Register dst,
365 const LocalVariable& variable) { 372 const LocalVariable& variable) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 if (num_opt_params == 0) { 544 if (num_opt_params == 0) {
538 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); 545 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
539 __ j(EQUAL, &argc_in_range, Assembler::kNearJump); 546 __ j(EQUAL, &argc_in_range, Assembler::kNearJump);
540 } else { 547 } else {
541 __ subl(EAX, Immediate(Smi::RawValue(num_fixed_params))); 548 __ subl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
542 __ cmpl(EAX, Immediate(Smi::RawValue(num_opt_params))); 549 __ cmpl(EAX, Immediate(Smi::RawValue(num_opt_params)));
543 __ j(BELOW_EQUAL, &argc_in_range, Assembler::kNearJump); 550 __ j(BELOW_EQUAL, &argc_in_range, Assembler::kNearJump);
544 } 551 }
545 if (function.IsClosureFunction()) { 552 if (function.IsClosureFunction()) {
546 GenerateCallRuntime(AstNode::kNoId, 553 GenerateCallRuntime(AstNode::kNoId,
547 function.token_index(), 554 0,
548 kClosureArgumentMismatchRuntimeEntry); 555 kClosureArgumentMismatchRuntimeEntry);
549 } else { 556 } else {
550 __ Stop("Wrong number of arguments"); 557 __ Stop("Wrong number of arguments");
551 } 558 }
552 __ Bind(&argc_in_range); 559 __ Bind(&argc_in_range);
553 } 560 }
554 } else { 561 } else {
555 ASSERT(first_param_index == -1); 562 ASSERT(first_param_index == -1);
556 // Copy positional arguments. 563 // Copy positional arguments.
557 // Check that no fewer than num_fixed_params positional arguments are passed 564 // Check that no fewer than num_fixed_params positional arguments are passed
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 delete[] opt_param; 669 delete[] opt_param;
663 delete[] opt_param_position; 670 delete[] opt_param_position;
664 // Check that EDI now points to the null terminator in the array descriptor. 671 // Check that EDI now points to the null terminator in the array descriptor.
665 Label all_arguments_processed; 672 Label all_arguments_processed;
666 __ cmpl(Address(EDI, 0), raw_null); 673 __ cmpl(Address(EDI, 0), raw_null);
667 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); 674 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
668 675
669 __ Bind(&wrong_num_arguments); 676 __ Bind(&wrong_num_arguments);
670 if (function.IsClosureFunction()) { 677 if (function.IsClosureFunction()) {
671 GenerateCallRuntime(AstNode::kNoId, 678 GenerateCallRuntime(AstNode::kNoId,
672 function.token_index(), 679 0,
673 kClosureArgumentMismatchRuntimeEntry); 680 kClosureArgumentMismatchRuntimeEntry);
674 } else { 681 } else {
675 // Invoke noSuchMethod function. 682 // Invoke noSuchMethod function.
676 ICData ic_data(String::Handle(function.name()), 1); 683 ICData ic_data(String::Handle(function.name()), 1);
677 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data())); 684 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data()));
678 // EBP : points to previous frame pointer. 685 // EBP : points to previous frame pointer.
679 // EBP + 4 : points to return address. 686 // EBP + 4 : points to return address.
680 // EBP + 8 : address of last argument (arg n-1). 687 // EBP + 8 : address of last argument (arg n-1).
681 // ESP + 8 + 4*(n-1) : address of first argument (arg 0). 688 // ESP + 8 + 4*(n-1) : address of first argument (arg 0).
682 // ECX : ic-data array. 689 // ECX : ic-data array.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 } 734 }
728 __ movl(Address(EBP, index * kWordSize), EAX); 735 __ movl(Address(EBP, index * kWordSize), EAX);
729 } 736 }
730 737
731 // Generate stack overflow check. 738 // Generate stack overflow check.
732 __ cmpl(ESP, 739 __ cmpl(ESP,
733 Address::Absolute(Isolate::Current()->stack_limit_address())); 740 Address::Absolute(Isolate::Current()->stack_limit_address()));
734 Label no_stack_overflow; 741 Label no_stack_overflow;
735 __ j(ABOVE, &no_stack_overflow); 742 __ j(ABOVE, &no_stack_overflow);
736 GenerateCallRuntime(AstNode::kNoId, 743 GenerateCallRuntime(AstNode::kNoId,
737 function.token_index(), 744 0,
738 kStackOverflowRuntimeEntry); 745 kStackOverflowRuntimeEntry);
739 __ Bind(&no_stack_overflow); 746 __ Bind(&no_stack_overflow);
740 } 747 }
741 748
742 749
743 void CodeGenerator::GenerateReturnEpilog() { 750 void CodeGenerator::GenerateReturnEpilog() {
744 // Unchain the context(s) up to context level 0. 751 // Unchain the context(s) up to context level 0.
745 int context_level = state()->context_level(); 752 int context_level = state()->context_level();
746 ASSERT(context_level >= 0); 753 ASSERT(context_level >= 0);
747 while (context_level-- > 0) { 754 while (context_level-- > 0) {
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 message_buffer, kMessageBufferSize, 2791 message_buffer, kMessageBufferSize,
2785 format, args); 2792 format, args);
2786 va_end(args); 2793 va_end(args);
2787 Isolate::Current()->long_jump_base()->Jump(1, message_buffer); 2794 Isolate::Current()->long_jump_base()->Jump(1, message_buffer);
2788 UNREACHABLE(); 2795 UNREACHABLE();
2789 } 2796 }
2790 2797
2791 } // namespace dart 2798 } // namespace dart
2792 2799
2793 #endif // defined TARGET_ARCH_IA32 2800 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698