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

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

Issue 8996024: Fix a bug in intrinsified Array_setIndexed type check. (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
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.h ('k') | tests/language/src/OptimizationTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/opt_code_generator.h" 8 #include "vm/opt_code_generator.h"
9 9
10 #include "vm/assembler_macros.h" 10 #include "vm/assembler_macros.h"
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 if (CodeGenerator::IsResultNeeded(node)) { 802 if (CodeGenerator::IsResultNeeded(node)) {
803 if (IsResultInEaxRequested(node)) { 803 if (IsResultInEaxRequested(node)) {
804 node->info()->set_result_returned_in_eax(true); 804 node->info()->set_result_returned_in_eax(true);
805 } else { 805 } else {
806 __ pushl(EAX); 806 __ pushl(EAX);
807 } 807 }
808 } 808 }
809 } 809 }
810 810
811 811
812 void OptimizingCodeGenerator::GenerateDoubleUnaryOp(UnaryOpNode* node) {
813 const Register kOperandRegister = ECX;
814 const Register kTempRegister = EBX;
815 const Register kResultRegister = EAX;
816 const ICData& ic_data = node->ICDataAtId(node->id());
817 DeoptReasonId deopt_reason_id = ic_data.NumberOfChecks() == 0 ?
818 kDeoptNoTypeFeedback : kDeoptUnaryOp;
819 DeoptimizationBlob* deopt_blob =
820 AddDeoptimizationBlob(node, kOperandRegister, deopt_reason_id);
821 CodeGenInfo info(node->operand());
822 VisitLoadOne(node->operand(), kOperandRegister);
823 if (ic_data.NumberOfChecks() == 0) {
824 // No type feedback.
825 __ jmp(deopt_blob->label());
826 return;
827 }
828 ASSERT(ic_data.NumberOfChecks() == 1);
829 CheckIfDoubleOrSmi(kOperandRegister,
830 kTempRegister,
831 deopt_blob->label(),
832 deopt_blob->label());
833 // TODO(srdjan): check if we could reuse a temporary object instead of
834 // allocating a new one.
835 const Code& stub =
836 Code::Handle(StubCode::GetAllocationStubForClass(double_class_));
837 const ExternalLabel label(double_class_.ToCString(), stub.EntryPoint());
838 __ pushl(kOperandRegister);
839 GenerateCall(node->token_index(), &label);
840 ASSERT(kResultRegister == EAX);
841 __ popl(kOperandRegister);
842 __ movsd(XMM0, FieldAddress(kOperandRegister, Double::value_offset()));
843 __ xorps(XMM1, XMM1); // 0.0 -> XMM1.
844 __ subsd(XMM1, XMM0);
845 __ movsd(FieldAddress(kResultRegister, Double::value_offset()), XMM1);
846 if (CodeGenerator::IsResultNeeded(node)) {
847 if (node->info() != NULL) {
848 node->info()->set_is_temp(true);
849 node->info()->set_is_class(&double_class_);
850 }
851 if (IsResultInEaxRequested(node)) {
852 ASSERT(kResultRegister == EAX);
853 node->info()->set_result_returned_in_eax(true);
854 } else {
855 __ pushl(kResultRegister);
856 }
857 }
858 }
859
860
812 // TODO(srdjan): Expand inline caches to detect Smi/double operations, so that 861 // TODO(srdjan): Expand inline caches to detect Smi/double operations, so that
813 // we do not have to call the instance method, and therefore could guarantee 862 // we do not have to call the instance method, and therefore could guarantee
814 // that the result is a Smi at the end. 863 // that the result is a Smi at the end.
815 void OptimizingCodeGenerator::GenerateSmiBinaryOp(BinaryOpNode* node) { 864 void OptimizingCodeGenerator::GenerateSmiBinaryOp(BinaryOpNode* node) {
816 const char* kOptMessage = "Inlines BinaryOp for Smi"; 865 const char* kOptMessage = "Inlines BinaryOp for Smi";
817 Label done; 866 Label done;
818 const Token::Kind kind = node->kind(); 867 const Token::Kind kind = node->kind();
819 if ((kind == Token::kADD) || 868 if ((kind == Token::kADD) ||
820 (kind == Token::kSUB) || 869 (kind == Token::kSUB) ||
821 (kind == Token::kMUL) || 870 (kind == Token::kMUL) ||
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 } 2995 }
2947 2996
2948 if ((node->kind() == Token::kSUB) || (node->kind() == Token::kBIT_NOT)) { 2997 if ((node->kind() == Token::kSUB) || (node->kind() == Token::kBIT_NOT)) {
2949 if (AtIdNodeHasOnlyClass(node, node->id(), smi_class_)) { 2998 if (AtIdNodeHasOnlyClass(node, node->id(), smi_class_)) {
2950 const ICData& ic_data = node->ICDataAtId(node->id()); 2999 const ICData& ic_data = node->ICDataAtId(node->id());
2951 ASSERT(ic_data.NumberOfArgumentsChecked() == 1); 3000 ASSERT(ic_data.NumberOfArgumentsChecked() == 1);
2952 GenerateSmiUnaryOp(node); 3001 GenerateSmiUnaryOp(node);
2953 return; 3002 return;
2954 } 3003 }
2955 } 3004 }
2956 // TODO(srdjan): Implement unary kSUB (negate) for doubles and Mint. 3005 if (node->kind() == Token::kSUB) {
3006 if (AtIdNodeHasReceiverClass(node, node->id(), double_class_)) {
3007 const ICData& ic_data = node->ICDataAtId(node->id());
3008 ASSERT(ic_data.NumberOfArgumentsChecked() == 1);
3009 GenerateDoubleUnaryOp(node);
3010 return;
3011 }
3012 }
3013 // TODO(srdjan): Implement unary kSUB (negate) Mint.
2957 CodeGenerator::VisitUnaryOpNode(node); 3014 CodeGenerator::VisitUnaryOpNode(node);
2958 } 3015 }
2959 3016
2960 3017
2961 } // namespace dart 3018 } // namespace dart
2962 3019
2963 #endif // defined TARGET_ARCH_IA32 3020 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.h ('k') | tests/language/src/OptimizationTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698