OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 4293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4304 } | 4304 } |
4305 | 4305 |
4306 | 4306 |
4307 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4307 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
4308 EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister()); | 4308 EmitLoadTypeFeedbackVector(masm, LoadWithVectorDescriptor::VectorRegister()); |
4309 KeyedLoadICStub stub(isolate(), state()); | 4309 KeyedLoadICStub stub(isolate(), state()); |
4310 stub.GenerateForTrampoline(masm); | 4310 stub.GenerateForTrampoline(masm); |
4311 } | 4311 } |
4312 | 4312 |
4313 | 4313 |
4314 static void HandleArrayCases(MacroAssembler* masm, Register receiver, | 4314 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
4315 Register key, Register vector, Register slot, | 4315 Register receiver_map, Register scratch1, |
4316 Register feedback, Register receiver_map, | 4316 Register scratch2, Register scratch3, |
4317 Register scratch1, Register scratch2, | 4317 bool is_polymorphic, Label* miss) { |
4318 Register scratch3, bool is_polymorphic, | |
4319 Label* miss) { | |
4320 // feedback initially contains the feedback array | 4318 // feedback initially contains the feedback array |
4321 Label next_loop, prepare_next; | 4319 Label next_loop, prepare_next; |
4322 Label start_polymorphic; | 4320 Label start_polymorphic; |
4323 | 4321 |
4324 Register counter = scratch1; | 4322 Register counter = scratch1; |
4325 Register length = scratch2; | 4323 Register length = scratch2; |
4326 Register cached_map = scratch3; | 4324 Register cached_map = scratch3; |
4327 | 4325 |
4328 __ movp(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); | 4326 __ movp(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); |
4329 __ cmpp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); | 4327 __ cmpp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4411 // at WeakCell::kValueOffset. | 4409 // at WeakCell::kValueOffset. |
4412 Label try_array, load_smi_map, compare_map; | 4410 Label try_array, load_smi_map, compare_map; |
4413 Label not_array, miss; | 4411 Label not_array, miss; |
4414 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, | 4412 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, |
4415 integer_slot, &compare_map, &load_smi_map, &try_array); | 4413 integer_slot, &compare_map, &load_smi_map, &try_array); |
4416 | 4414 |
4417 // Is it a fixed array? | 4415 // Is it a fixed array? |
4418 __ bind(&try_array); | 4416 __ bind(&try_array); |
4419 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | 4417 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); |
4420 __ j(not_equal, ¬_array); | 4418 __ j(not_equal, ¬_array); |
4421 HandleArrayCases(masm, receiver, name, vector, slot, feedback, receiver_map, | 4419 HandleArrayCases(masm, feedback, receiver_map, integer_slot, r11, r15, true, |
4422 integer_slot, r11, r15, true, &miss); | 4420 &miss); |
4423 | 4421 |
4424 __ bind(¬_array); | 4422 __ bind(¬_array); |
4425 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4423 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
4426 __ j(not_equal, &miss); | 4424 __ j(not_equal, &miss); |
4427 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( | 4425 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( |
4428 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 4426 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
4429 masm->isolate()->stub_cache()->GenerateProbe( | 4427 masm->isolate()->stub_cache()->GenerateProbe( |
4430 masm, Code::LOAD_IC, code_flags, receiver, name, feedback, no_reg); | 4428 masm, Code::LOAD_IC, code_flags, receiver, name, feedback, no_reg); |
4431 | 4429 |
4432 __ bind(&miss); | 4430 __ bind(&miss); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4470 integer_slot, &compare_map, &load_smi_map, &try_array); | 4468 integer_slot, &compare_map, &load_smi_map, &try_array); |
4471 | 4469 |
4472 __ bind(&try_array); | 4470 __ bind(&try_array); |
4473 // Is it a fixed array? | 4471 // Is it a fixed array? |
4474 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | 4472 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); |
4475 __ j(not_equal, ¬_array); | 4473 __ j(not_equal, ¬_array); |
4476 | 4474 |
4477 // We have a polymorphic element handler. | 4475 // We have a polymorphic element handler. |
4478 Label polymorphic, try_poly_name; | 4476 Label polymorphic, try_poly_name; |
4479 __ bind(&polymorphic); | 4477 __ bind(&polymorphic); |
4480 HandleArrayCases(masm, receiver, key, vector, slot, feedback, receiver_map, | 4478 HandleArrayCases(masm, feedback, receiver_map, integer_slot, r11, r15, true, |
4481 integer_slot, r11, r15, true, &miss); | 4479 &miss); |
4482 | 4480 |
4483 __ bind(¬_array); | 4481 __ bind(¬_array); |
4484 // Is it generic? | 4482 // Is it generic? |
4485 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | 4483 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
4486 __ j(not_equal, &try_poly_name); | 4484 __ j(not_equal, &try_poly_name); |
4487 Handle<Code> megamorphic_stub = | 4485 Handle<Code> megamorphic_stub = |
4488 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | 4486 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); |
4489 __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET); | 4487 __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET); |
4490 | 4488 |
4491 __ bind(&try_poly_name); | 4489 __ bind(&try_poly_name); |
4492 // We might have a name in feedback, and a fixed array in the next slot. | 4490 // We might have a name in feedback, and a fixed array in the next slot. |
4493 __ cmpp(key, feedback); | 4491 __ cmpp(key, feedback); |
4494 __ j(not_equal, &miss); | 4492 __ j(not_equal, &miss); |
4495 // If the name comparison succeeded, we know we have a fixed array with | 4493 // If the name comparison succeeded, we know we have a fixed array with |
4496 // at least one map/handler pair. | 4494 // at least one map/handler pair. |
4497 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, | 4495 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, |
4498 FixedArray::kHeaderSize + kPointerSize)); | 4496 FixedArray::kHeaderSize + kPointerSize)); |
4499 HandleArrayCases(masm, receiver, key, vector, slot, feedback, receiver_map, | 4497 HandleArrayCases(masm, feedback, receiver_map, integer_slot, r11, r15, false, |
4500 integer_slot, r11, r15, false, &miss); | 4498 &miss); |
4501 | 4499 |
4502 __ bind(&miss); | 4500 __ bind(&miss); |
4503 KeyedLoadIC::GenerateMiss(masm); | 4501 KeyedLoadIC::GenerateMiss(masm); |
4504 | 4502 |
4505 __ bind(&load_smi_map); | 4503 __ bind(&load_smi_map); |
4506 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 4504 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
4507 __ jmp(&compare_map); | 4505 __ jmp(&compare_map); |
4508 } | 4506 } |
4509 | 4507 |
4510 | 4508 |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5512 kStackSpace, nullptr, return_value_operand, NULL); | 5510 kStackSpace, nullptr, return_value_operand, NULL); |
5513 } | 5511 } |
5514 | 5512 |
5515 | 5513 |
5516 #undef __ | 5514 #undef __ |
5517 | 5515 |
5518 } // namespace internal | 5516 } // namespace internal |
5519 } // namespace v8 | 5517 } // namespace v8 |
5520 | 5518 |
5521 #endif // V8_TARGET_ARCH_X64 | 5519 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |