| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4022 movp(result, FieldOperand(map, Map::kConstructorOrBackPointerOffset)); | 4022 movp(result, FieldOperand(map, Map::kConstructorOrBackPointerOffset)); |
| 4023 bind(&loop); | 4023 bind(&loop); |
| 4024 JumpIfSmi(result, &done, Label::kNear); | 4024 JumpIfSmi(result, &done, Label::kNear); |
| 4025 CmpObjectType(result, MAP_TYPE, temp); | 4025 CmpObjectType(result, MAP_TYPE, temp); |
| 4026 j(not_equal, &done, Label::kNear); | 4026 j(not_equal, &done, Label::kNear); |
| 4027 movp(result, FieldOperand(result, Map::kConstructorOrBackPointerOffset)); | 4027 movp(result, FieldOperand(result, Map::kConstructorOrBackPointerOffset)); |
| 4028 jmp(&loop); | 4028 jmp(&loop); |
| 4029 bind(&done); | 4029 bind(&done); |
| 4030 } | 4030 } |
| 4031 | 4031 |
| 4032 | |
| 4033 void MacroAssembler::TryGetFunctionPrototype(Register function, Register result, | |
| 4034 Label* miss) { | |
| 4035 // Get the prototype or initial map from the function. | |
| 4036 movp(result, | |
| 4037 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 4038 | |
| 4039 // If the prototype or initial map is the hole, don't return it and | |
| 4040 // simply miss the cache instead. This will allow us to allocate a | |
| 4041 // prototype object on-demand in the runtime system. | |
| 4042 CompareRoot(result, Heap::kTheHoleValueRootIndex); | |
| 4043 j(equal, miss); | |
| 4044 | |
| 4045 // If the function does not have an initial map, we're done. | |
| 4046 Label done; | |
| 4047 CmpObjectType(result, MAP_TYPE, kScratchRegister); | |
| 4048 j(not_equal, &done, Label::kNear); | |
| 4049 | |
| 4050 // Get the prototype from the initial map. | |
| 4051 movp(result, FieldOperand(result, Map::kPrototypeOffset)); | |
| 4052 | |
| 4053 // All done. | |
| 4054 bind(&done); | |
| 4055 } | |
| 4056 | |
| 4057 | |
| 4058 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 4032 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
| 4059 if (FLAG_native_code_counters && counter->Enabled()) { | 4033 if (FLAG_native_code_counters && counter->Enabled()) { |
| 4060 Operand counter_operand = ExternalOperand(ExternalReference(counter)); | 4034 Operand counter_operand = ExternalOperand(ExternalReference(counter)); |
| 4061 movl(counter_operand, Immediate(value)); | 4035 movl(counter_operand, Immediate(value)); |
| 4062 } | 4036 } |
| 4063 } | 4037 } |
| 4064 | 4038 |
| 4065 | 4039 |
| 4066 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { | 4040 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { |
| 4067 DCHECK(value > 0); | 4041 DCHECK(value > 0); |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5307 movl(rax, dividend); | 5281 movl(rax, dividend); |
| 5308 shrl(rax, Immediate(31)); | 5282 shrl(rax, Immediate(31)); |
| 5309 addl(rdx, rax); | 5283 addl(rdx, rax); |
| 5310 } | 5284 } |
| 5311 | 5285 |
| 5312 | 5286 |
| 5313 } // namespace internal | 5287 } // namespace internal |
| 5314 } // namespace v8 | 5288 } // namespace v8 |
| 5315 | 5289 |
| 5316 #endif // V8_TARGET_ARCH_X64 | 5290 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |