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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 21536003: Migrate instance of deprecated maps in HCheckMaps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Port to ARM Created 7 years, 4 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 void LCodeGen::LoadContextFromDeferred(LOperand* context) { 875 void LCodeGen::LoadContextFromDeferred(LOperand* context) {
876 if (context->IsRegister()) { 876 if (context->IsRegister()) {
877 if (!ToRegister(context).is(esi)) { 877 if (!ToRegister(context).is(esi)) {
878 __ mov(esi, ToRegister(context)); 878 __ mov(esi, ToRegister(context));
879 } 879 }
880 } else if (context->IsStackSlot()) { 880 } else if (context->IsStackSlot()) {
881 __ mov(esi, ToOperand(context)); 881 __ mov(esi, ToOperand(context));
882 } else if (context->IsConstantOperand()) { 882 } else if (context->IsConstantOperand()) {
883 HConstant* constant = 883 HConstant* constant =
884 chunk_->LookupConstant(LConstantOperand::cast(context)); 884 chunk_->LookupConstant(LConstantOperand::cast(context));
885 __ LoadHeapObject(esi, Handle<Context>::cast(constant->handle())); 885 __ LoadObject(esi, Handle<Object>::cast(constant->handle()));
886 } else { 886 } else {
887 UNREACHABLE(); 887 UNREACHABLE();
888 } 888 }
889 } 889 }
890 890
891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, 891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id,
892 int argc, 892 int argc,
893 LInstruction* instr, 893 LInstruction* instr,
894 LOperand* context) { 894 LOperand* context) {
895 LoadContextFromDeferred(context); 895 LoadContextFromDeferred(context);
(...skipping 4890 matching lines...) Expand 10 before | Expand all | Expand 10 after
5786 Handle<Cell> cell = isolate()->factory()->NewCell(target); 5786 Handle<Cell> cell = isolate()->factory()->NewCell(target);
5787 __ cmp(reg, Operand::ForCell(cell)); 5787 __ cmp(reg, Operand::ForCell(cell));
5788 } else { 5788 } else {
5789 Operand operand = ToOperand(instr->value()); 5789 Operand operand = ToOperand(instr->value());
5790 __ cmp(operand, target); 5790 __ cmp(operand, target);
5791 } 5791 }
5792 DeoptimizeIf(not_equal, instr->environment()); 5792 DeoptimizeIf(not_equal, instr->environment());
5793 } 5793 }
5794 5794
5795 5795
5796 void LCodeGen::DoCheckMapCommon(Register reg, 5796 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
5797 Handle<Map> map, 5797 {
5798 LInstruction* instr) { 5798 PushSafepointRegistersScope scope(this);
5799 Label success; 5799 __ push(object);
5800 __ CompareMap(reg, map, &success); 5800 CallRuntimeFromDeferred(
5801 DeoptimizeIf(not_equal, instr->environment()); 5801 Runtime::kMigrateInstance, 1, instr, instr->context());
danno 2013/08/05 14:36:59 I think you can make the code much smaller and sim
Toon Verwaest 2013/08/05 15:03:26 Done.
5802 __ bind(&success); 5802 __ test(eax, Immediate(kSmiTagMask));
5803 }
5804 DeoptimizeIf(zero, instr->environment());
5803 } 5805 }
5804 5806
5805 5807
5806 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { 5808 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5809 class DeferredInstanceMigration: public LDeferredCode {
5810 public:
5811 DeferredInstanceMigration(LCodeGen* codegen,
5812 LCheckMaps* instr,
5813 Register object)
5814 : LDeferredCode(codegen), instr_(instr), object_(object) {
5815 SetExit(check_maps());
5816 }
5817 virtual void Generate() {
5818 codegen()->DoDeferredInstanceMigration(instr_, object_);
5819 }
5820 Label* check_maps() { return &check_maps_; }
5821 virtual LInstruction* instr() { return instr_; }
5822 private:
5823 LCheckMaps* instr_;
5824 Label check_maps_;
5825 Register object_;
5826 };
5827
5807 if (instr->hydrogen()->CanOmitMapChecks()) return; 5828 if (instr->hydrogen()->CanOmitMapChecks()) return;
5829
5808 LOperand* input = instr->value(); 5830 LOperand* input = instr->value();
5809 ASSERT(input->IsRegister()); 5831 ASSERT(input->IsRegister());
5810 Register reg = ToRegister(input); 5832 Register reg = ToRegister(input);
5811 5833
5834 SmallMapList* map_set = instr->hydrogen()->map_set();
5835
5836 DeferredInstanceMigration* deferred = NULL;
5837 if (instr->hydrogen()->has_migration_target()) {
5838 deferred = new(zone()) DeferredInstanceMigration(this, instr, reg);
5839 __ bind(deferred->check_maps());
5840 }
5841
5812 Label success; 5842 Label success;
5813 SmallMapList* map_set = instr->hydrogen()->map_set();
5814 for (int i = 0; i < map_set->length() - 1; i++) { 5843 for (int i = 0; i < map_set->length() - 1; i++) {
5815 Handle<Map> map = map_set->at(i); 5844 Handle<Map> map = map_set->at(i);
5816 __ CompareMap(reg, map, &success); 5845 __ CompareMap(reg, map, &success);
5817 __ j(equal, &success); 5846 __ j(equal, &success);
5818 } 5847 }
5848
5819 Handle<Map> map = map_set->last(); 5849 Handle<Map> map = map_set->last();
5820 DoCheckMapCommon(reg, map, instr); 5850 __ CompareMap(reg, map, &success);
5851 if (instr->hydrogen()->has_migration_target()) {
5852 __ j(not_equal, deferred->entry());
5853 } else {
5854 DeoptimizeIf(not_equal, instr->environment());
5855 }
5856
5821 __ bind(&success); 5857 __ bind(&success);
5822 } 5858 }
5823 5859
5824 5860
5825 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { 5861 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5826 CpuFeatureScope scope(masm(), SSE2); 5862 CpuFeatureScope scope(masm(), SSE2);
5827 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); 5863 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
5828 Register result_reg = ToRegister(instr->result()); 5864 Register result_reg = ToRegister(instr->result());
5829 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); 5865 __ ClampDoubleToUint8(value_reg, xmm0, result_reg);
5830 } 5866 }
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
6495 FixedArray::kHeaderSize - kPointerSize)); 6531 FixedArray::kHeaderSize - kPointerSize));
6496 __ bind(&done); 6532 __ bind(&done);
6497 } 6533 }
6498 6534
6499 6535
6500 #undef __ 6536 #undef __
6501 6537
6502 } } // namespace v8::internal 6538 } } // namespace v8::internal
6503 6539
6504 #endif // V8_TARGET_ARCH_IA32 6540 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698