OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4954 | 4954 |
4955 | 4955 |
4956 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 4956 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
4957 Register reg = ToRegister(instr->value()); | 4957 Register reg = ToRegister(instr->value()); |
4958 Handle<JSFunction> target = instr->hydrogen()->target(); | 4958 Handle<JSFunction> target = instr->hydrogen()->target(); |
4959 __ CmpHeapObject(reg, target); | 4959 __ CmpHeapObject(reg, target); |
4960 DeoptimizeIf(not_equal, instr->environment()); | 4960 DeoptimizeIf(not_equal, instr->environment()); |
4961 } | 4961 } |
4962 | 4962 |
4963 | 4963 |
4964 void LCodeGen::DoCheckMapCommon(Register reg, | 4964 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
4965 Handle<Map> map, | 4965 { |
4966 LInstruction* instr) { | 4966 PushSafepointRegistersScope scope(this); |
4967 Label success; | 4967 __ push(object); |
4968 __ CompareMap(reg, map, &success); | 4968 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
4969 DeoptimizeIf(not_equal, instr->environment()); | 4969 __ testq(rax, Immediate(kSmiTagMask)); |
4970 __ bind(&success); | 4970 } |
4971 DeoptimizeIf(zero, instr->environment()); | |
4971 } | 4972 } |
4972 | 4973 |
4973 | 4974 |
4974 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4975 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
4976 class DeferredInstanceMigration: public LDeferredCode { | |
danno
2013/08/05 14:36:59
Do you want this class here or in the outer scope
Toon Verwaest
2013/08/05 15:03:26
Done.
| |
4977 public: | |
4978 DeferredInstanceMigration(LCodeGen* codegen, | |
4979 LCheckMaps* instr, | |
4980 Register object) | |
4981 : LDeferredCode(codegen), instr_(instr), object_(object) { | |
4982 SetExit(check_maps()); | |
4983 } | |
4984 virtual void Generate() { | |
4985 codegen()->DoDeferredInstanceMigration(instr_, object_); | |
4986 } | |
4987 Label* check_maps() { return &check_maps_; } | |
4988 virtual LInstruction* instr() { return instr_; } | |
4989 private: | |
4990 LCheckMaps* instr_; | |
4991 Label check_maps_; | |
4992 Register object_; | |
4993 }; | |
4994 | |
4975 if (instr->hydrogen()->CanOmitMapChecks()) return; | 4995 if (instr->hydrogen()->CanOmitMapChecks()) return; |
4996 | |
4976 LOperand* input = instr->value(); | 4997 LOperand* input = instr->value(); |
4977 ASSERT(input->IsRegister()); | 4998 ASSERT(input->IsRegister()); |
4978 Register reg = ToRegister(input); | 4999 Register reg = ToRegister(input); |
4979 | 5000 |
5001 SmallMapList* map_set = instr->hydrogen()->map_set(); | |
5002 | |
5003 DeferredInstanceMigration* deferred = NULL; | |
5004 if (instr->hydrogen()->has_migration_target()) { | |
5005 deferred = new(zone()) DeferredInstanceMigration(this, instr, reg); | |
5006 __ bind(deferred->check_maps()); | |
5007 } | |
5008 | |
4980 Label success; | 5009 Label success; |
4981 SmallMapList* map_set = instr->hydrogen()->map_set(); | |
4982 for (int i = 0; i < map_set->length() - 1; i++) { | 5010 for (int i = 0; i < map_set->length() - 1; i++) { |
4983 Handle<Map> map = map_set->at(i); | 5011 Handle<Map> map = map_set->at(i); |
4984 __ CompareMap(reg, map, &success); | 5012 __ CompareMap(reg, map, &success); |
4985 __ j(equal, &success); | 5013 __ j(equal, &success); |
4986 } | 5014 } |
5015 | |
4987 Handle<Map> map = map_set->last(); | 5016 Handle<Map> map = map_set->last(); |
4988 DoCheckMapCommon(reg, map, instr); | 5017 __ CompareMap(reg, map, &success); |
5018 if (instr->hydrogen()->has_migration_target()) { | |
5019 __ j(not_equal, deferred->entry()); | |
5020 } else { | |
5021 DeoptimizeIf(not_equal, instr->environment()); | |
5022 } | |
5023 | |
4989 __ bind(&success); | 5024 __ bind(&success); |
4990 } | 5025 } |
4991 | 5026 |
4992 | 5027 |
4993 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5028 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
4994 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5029 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
4995 Register result_reg = ToRegister(instr->result()); | 5030 Register result_reg = ToRegister(instr->result()); |
4996 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); | 5031 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); |
4997 } | 5032 } |
4998 | 5033 |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5548 FixedArray::kHeaderSize - kPointerSize)); | 5583 FixedArray::kHeaderSize - kPointerSize)); |
5549 __ bind(&done); | 5584 __ bind(&done); |
5550 } | 5585 } |
5551 | 5586 |
5552 | 5587 |
5553 #undef __ | 5588 #undef __ |
5554 | 5589 |
5555 } } // namespace v8::internal | 5590 } } // namespace v8::internal |
5556 | 5591 |
5557 #endif // V8_TARGET_ARCH_X64 | 5592 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |