| 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 DeferredCheckMaps: public LDeferredCode { |
| 4977 public: |
| 4978 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 4979 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 4980 SetExit(check_maps()); |
| 4981 } |
| 4982 virtual void Generate() { |
| 4983 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 4984 } |
| 4985 Label* check_maps() { return &check_maps_; } |
| 4986 virtual LInstruction* instr() { return instr_; } |
| 4987 private: |
| 4988 LCheckMaps* instr_; |
| 4989 Label check_maps_; |
| 4990 Register object_; |
| 4991 }; |
| 4992 |
| 4975 if (instr->hydrogen()->CanOmitMapChecks()) return; | 4993 if (instr->hydrogen()->CanOmitMapChecks()) return; |
| 4994 |
| 4976 LOperand* input = instr->value(); | 4995 LOperand* input = instr->value(); |
| 4977 ASSERT(input->IsRegister()); | 4996 ASSERT(input->IsRegister()); |
| 4978 Register reg = ToRegister(input); | 4997 Register reg = ToRegister(input); |
| 4979 | 4998 |
| 4999 SmallMapList* map_set = instr->hydrogen()->map_set(); |
| 5000 |
| 5001 DeferredCheckMaps* deferred = NULL; |
| 5002 if (instr->hydrogen()->has_migration_target()) { |
| 5003 deferred = new(zone()) DeferredCheckMaps(this, instr, reg); |
| 5004 __ bind(deferred->check_maps()); |
| 5005 } |
| 5006 |
| 4980 Label success; | 5007 Label success; |
| 4981 SmallMapList* map_set = instr->hydrogen()->map_set(); | |
| 4982 for (int i = 0; i < map_set->length() - 1; i++) { | 5008 for (int i = 0; i < map_set->length() - 1; i++) { |
| 4983 Handle<Map> map = map_set->at(i); | 5009 Handle<Map> map = map_set->at(i); |
| 4984 __ CompareMap(reg, map, &success); | 5010 __ CompareMap(reg, map, &success); |
| 4985 __ j(equal, &success); | 5011 __ j(equal, &success); |
| 4986 } | 5012 } |
| 5013 |
| 4987 Handle<Map> map = map_set->last(); | 5014 Handle<Map> map = map_set->last(); |
| 4988 DoCheckMapCommon(reg, map, instr); | 5015 __ CompareMap(reg, map, &success); |
| 5016 if (instr->hydrogen()->has_migration_target()) { |
| 5017 __ j(not_equal, deferred->entry()); |
| 5018 } else { |
| 5019 DeoptimizeIf(not_equal, instr->environment()); |
| 5020 } |
| 5021 |
| 4989 __ bind(&success); | 5022 __ bind(&success); |
| 4990 } | 5023 } |
| 4991 | 5024 |
| 4992 | 5025 |
| 4993 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5026 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
| 4994 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5027 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
| 4995 Register result_reg = ToRegister(instr->result()); | 5028 Register result_reg = ToRegister(instr->result()); |
| 4996 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); | 5029 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); |
| 4997 } | 5030 } |
| 4998 | 5031 |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5548 FixedArray::kHeaderSize - kPointerSize)); | 5581 FixedArray::kHeaderSize - kPointerSize)); |
| 5549 __ bind(&done); | 5582 __ bind(&done); |
| 5550 } | 5583 } |
| 5551 | 5584 |
| 5552 | 5585 |
| 5553 #undef __ | 5586 #undef __ |
| 5554 | 5587 |
| 5555 } } // namespace v8::internal | 5588 } } // namespace v8::internal |
| 5556 | 5589 |
| 5557 #endif // V8_TARGET_ARCH_X64 | 5590 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |