OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 __ cmpl(rax, FieldOperand(rcx, PixelArray::kLengthOffset)); | 313 __ cmpl(rax, FieldOperand(rcx, PixelArray::kLengthOffset)); |
314 __ j(above_equal, &slow); | 314 __ j(above_equal, &slow); |
315 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); | 315 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); |
316 __ movb(rax, Operand(rcx, rax, times_1, 0)); | 316 __ movb(rax, Operand(rcx, rax, times_1, 0)); |
317 __ Integer32ToSmi(rax, rax); | 317 __ Integer32ToSmi(rax, rax); |
318 __ ret(0); | 318 __ ret(0); |
319 | 319 |
320 // Slow case: Load name and receiver from stack and jump to runtime. | 320 // Slow case: Load name and receiver from stack and jump to runtime. |
321 __ bind(&slow); | 321 __ bind(&slow); |
322 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); | 322 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); |
323 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 323 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
324 __ bind(&check_string); | 324 __ bind(&check_string); |
325 // The key is not a smi. | 325 // The key is not a smi. |
326 // Is it a string? | 326 // Is it a string? |
327 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); | 327 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); |
328 __ j(above_equal, &slow); | 328 __ j(above_equal, &slow); |
329 // Is the string an array index, with cached numeric value? | 329 // Is the string an array index, with cached numeric value? |
330 __ movl(rbx, FieldOperand(rax, String::kLengthOffset)); | 330 __ movl(rbx, FieldOperand(rax, String::kLengthOffset)); |
331 __ testl(rbx, Immediate(String::kIsArrayIndexMask)); | 331 __ testl(rbx, Immediate(String::kIsArrayIndexMask)); |
332 | 332 |
333 // If the string is a symbol, do a quick inline probe of the receiver's | 333 // If the string is a symbol, do a quick inline probe of the receiver's |
(...skipping 19 matching lines...) Expand all Loading... |
353 (String::kMaxCachedArrayIndexLength + 1) << String::kShortLengthShift; | 353 (String::kMaxCachedArrayIndexLength + 1) << String::kShortLengthShift; |
354 __ cmpl(rbx, Immediate(kLengthFieldLimit)); | 354 __ cmpl(rbx, Immediate(kLengthFieldLimit)); |
355 __ j(above_equal, &slow); | 355 __ j(above_equal, &slow); |
356 __ movl(rax, rbx); | 356 __ movl(rax, rbx); |
357 __ and_(rax, Immediate((1 << String::kShortLengthShift) - 1)); | 357 __ and_(rax, Immediate((1 << String::kShortLengthShift) - 1)); |
358 __ shrl(rax, Immediate(String::kLongLengthShift)); | 358 __ shrl(rax, Immediate(String::kLongLengthShift)); |
359 __ jmp(&index_int); | 359 __ jmp(&index_int); |
360 } | 360 } |
361 | 361 |
362 | 362 |
| 363 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
| 364 ExternalArrayType array_type) { |
| 365 GenerateGeneric(masm); |
| 366 } |
| 367 |
| 368 |
363 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 369 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
364 // ----------- S t a t e ------------- | 370 // ----------- S t a t e ------------- |
365 // -- rsp[0] : return address | 371 // -- rsp[0] : return address |
366 // -- rsp[8] : name | 372 // -- rsp[8] : name |
367 // -- rsp[16] : receiver | 373 // -- rsp[16] : receiver |
368 // ----------------------------------- | 374 // ----------------------------------- |
369 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); | 375 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); |
370 } | 376 } |
371 | 377 |
372 | 378 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 Heap::kFixedArrayMapRootIndex); | 457 Heap::kFixedArrayMapRootIndex); |
452 __ j(not_equal, &check_pixel_array); | 458 __ j(not_equal, &check_pixel_array); |
453 // Untag the key (for checking against untagged length in the fixed array). | 459 // Untag the key (for checking against untagged length in the fixed array). |
454 __ SmiToInteger32(rdx, rbx); | 460 __ SmiToInteger32(rdx, rbx); |
455 __ cmpl(rdx, FieldOperand(rcx, Array::kLengthOffset)); | 461 __ cmpl(rdx, FieldOperand(rcx, Array::kLengthOffset)); |
456 // rax: value | 462 // rax: value |
457 // rcx: FixedArray | 463 // rcx: FixedArray |
458 // rbx: index (as a smi) | 464 // rbx: index (as a smi) |
459 __ j(below, &fast); | 465 __ j(below, &fast); |
460 | 466 |
461 // Slow case: Push extra copies of the arguments (3). | 467 // Slow case: call runtime. |
462 __ bind(&slow); | 468 __ bind(&slow); |
463 __ pop(rcx); | 469 Generate(masm, ExternalReference(Runtime::kSetProperty)); |
464 __ push(Operand(rsp, 1 * kPointerSize)); | |
465 __ push(Operand(rsp, 1 * kPointerSize)); | |
466 __ push(rax); | |
467 __ push(rcx); | |
468 // Do tail-call to runtime routine. | |
469 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); | |
470 | 470 |
471 // Check whether the elements is a pixel array. | 471 // Check whether the elements is a pixel array. |
472 // rax: value | 472 // rax: value |
473 // rcx: elements array | 473 // rcx: elements array |
474 // rbx: index (as a smi), zero-extended. | 474 // rbx: index (as a smi), zero-extended. |
475 __ bind(&check_pixel_array); | 475 __ bind(&check_pixel_array); |
476 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 476 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
477 Heap::kPixelArrayMapRootIndex); | 477 Heap::kPixelArrayMapRootIndex); |
478 __ j(not_equal, &slow); | 478 __ j(not_equal, &slow); |
479 // Check that the value is a smi. If a conversion is needed call into the | 479 // Check that the value is a smi. If a conversion is needed call into the |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 SmiIndex index2 = masm->SmiToIndex(kScratchRegister, rbx, kPointerSizeLog2); | 551 SmiIndex index2 = masm->SmiToIndex(kScratchRegister, rbx, kPointerSizeLog2); |
552 __ movq(Operand(rcx, index2.reg, index2.scale, | 552 __ movq(Operand(rcx, index2.reg, index2.scale, |
553 FixedArray::kHeaderSize - kHeapObjectTag), | 553 FixedArray::kHeaderSize - kHeapObjectTag), |
554 rax); | 554 rax); |
555 __ movq(rdx, rax); | 555 __ movq(rdx, rax); |
556 __ RecordWriteNonSmi(rcx, 0, rdx, rbx); | 556 __ RecordWriteNonSmi(rcx, 0, rdx, rbx); |
557 __ ret(0); | 557 __ ret(0); |
558 } | 558 } |
559 | 559 |
560 | 560 |
| 561 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, |
| 562 ExternalArrayType array_type) { |
| 563 GenerateGeneric(masm); |
| 564 } |
| 565 |
| 566 |
561 void CallIC::Generate(MacroAssembler* masm, | 567 void CallIC::Generate(MacroAssembler* masm, |
562 int argc, | 568 int argc, |
563 ExternalReference const& f) { | 569 ExternalReference const& f) { |
564 // Get the receiver of the function from the stack; 1 ~ return address. | 570 // Get the receiver of the function from the stack; 1 ~ return address. |
565 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 571 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
566 // Get the name of the function to call from the stack. | 572 // Get the name of the function to call from the stack. |
567 // 2 ~ receiver, return address. | 573 // 2 ~ receiver, return address. |
568 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize)); | 574 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize)); |
569 | 575 |
570 // Enter an internal frame. | 576 // Enter an internal frame. |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 | 1023 |
1018 // Cache miss: Jump to runtime. | 1024 // Cache miss: Jump to runtime. |
1019 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); | 1025 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
1020 } | 1026 } |
1021 | 1027 |
1022 | 1028 |
1023 #undef __ | 1029 #undef __ |
1024 | 1030 |
1025 | 1031 |
1026 } } // namespace v8::internal | 1032 } } // namespace v8::internal |
OLD | NEW |