OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset)); | 294 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset)); |
295 __ j(above_equal, &slow); | 295 __ j(above_equal, &slow); |
296 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); | 296 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); |
297 __ movzx_b(eax, Operand(ecx, eax, times_1, 0)); | 297 __ movzx_b(eax, Operand(ecx, eax, times_1, 0)); |
298 __ shl(eax, kSmiTagSize); | 298 __ shl(eax, kSmiTagSize); |
299 __ ret(0); | 299 __ ret(0); |
300 | 300 |
301 // Slow case: Load name and receiver from stack and jump to runtime. | 301 // Slow case: Load name and receiver from stack and jump to runtime. |
302 __ bind(&slow); | 302 __ bind(&slow); |
303 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); | 303 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); |
304 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 304 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
305 | 305 |
306 __ bind(&check_string); | 306 __ bind(&check_string); |
307 // The key is not a smi. | 307 // The key is not a smi. |
308 // Is it a string? | 308 // Is it a string? |
309 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); | 309 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); |
310 __ j(above_equal, &slow); | 310 __ j(above_equal, &slow); |
311 // Is the string an array index, with cached numeric value? | 311 // Is the string an array index, with cached numeric value? |
312 __ mov(ebx, FieldOperand(eax, String::kLengthOffset)); | 312 __ mov(ebx, FieldOperand(eax, String::kLengthOffset)); |
313 __ test(ebx, Immediate(String::kIsArrayIndexMask)); | 313 __ test(ebx, Immediate(String::kIsArrayIndexMask)); |
314 __ j(not_zero, &index_string, not_taken); | 314 __ j(not_zero, &index_string, not_taken); |
(...skipping 20 matching lines...) Expand all Loading... |
335 (String::kMaxCachedArrayIndexLength + 1) << String::kShortLengthShift; | 335 (String::kMaxCachedArrayIndexLength + 1) << String::kShortLengthShift; |
336 __ cmp(ebx, kLengthFieldLimit); | 336 __ cmp(ebx, kLengthFieldLimit); |
337 __ j(above_equal, &slow); | 337 __ j(above_equal, &slow); |
338 __ mov(eax, Operand(ebx)); | 338 __ mov(eax, Operand(ebx)); |
339 __ and_(eax, (1 << String::kShortLengthShift) - 1); | 339 __ and_(eax, (1 << String::kShortLengthShift) - 1); |
340 __ shr(eax, String::kLongLengthShift); | 340 __ shr(eax, String::kLongLengthShift); |
341 __ jmp(&index_int); | 341 __ jmp(&index_int); |
342 } | 342 } |
343 | 343 |
344 | 344 |
| 345 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
| 346 ExternalArrayType array_type) { |
| 347 GenerateGeneric(masm); |
| 348 } |
| 349 |
| 350 |
345 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 351 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
346 // ----------- S t a t e ------------- | 352 // ----------- S t a t e ------------- |
347 // -- eax : value | 353 // -- eax : value |
348 // -- esp[0] : return address | 354 // -- esp[0] : return address |
349 // -- esp[4] : key | 355 // -- esp[4] : key |
350 // -- esp[8] : receiver | 356 // -- esp[8] : receiver |
351 // ----------------------------------- | 357 // ----------------------------------- |
352 Label slow, fast, array, extra, check_pixel_array; | 358 Label slow, fast, array, extra, check_pixel_array; |
353 | 359 |
354 // Get the receiver from the stack. | 360 // Get the receiver from the stack. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 __ j(not_equal, &check_pixel_array, not_taken); | 394 __ j(not_equal, &check_pixel_array, not_taken); |
389 // Untag the key (for checking against untagged length in the fixed array). | 395 // Untag the key (for checking against untagged length in the fixed array). |
390 __ mov(edx, Operand(ebx)); | 396 __ mov(edx, Operand(ebx)); |
391 __ sar(edx, kSmiTagSize); // untag the index and use it for the comparison | 397 __ sar(edx, kSmiTagSize); // untag the index and use it for the comparison |
392 __ cmp(edx, FieldOperand(ecx, Array::kLengthOffset)); | 398 __ cmp(edx, FieldOperand(ecx, Array::kLengthOffset)); |
393 // eax: value | 399 // eax: value |
394 // ecx: FixedArray | 400 // ecx: FixedArray |
395 // ebx: index (as a smi) | 401 // ebx: index (as a smi) |
396 __ j(below, &fast, taken); | 402 __ j(below, &fast, taken); |
397 | 403 |
398 // Slow case: Push extra copies of the arguments (3). | 404 // Slow case: call runtime. |
399 __ bind(&slow); | 405 __ bind(&slow); |
400 __ pop(ecx); | 406 Generate(masm, ExternalReference(Runtime::kSetProperty)); |
401 __ push(Operand(esp, 1 * kPointerSize)); | |
402 __ push(Operand(esp, 1 * kPointerSize)); | |
403 __ push(eax); | |
404 __ push(ecx); | |
405 // Do tail-call to runtime routine. | |
406 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); | |
407 | 407 |
408 // Check whether the elements is a pixel array. | 408 // Check whether the elements is a pixel array. |
409 // eax: value | 409 // eax: value |
410 // ecx: elements array | 410 // ecx: elements array |
411 // ebx: index (as a smi) | 411 // ebx: index (as a smi) |
412 __ bind(&check_pixel_array); | 412 __ bind(&check_pixel_array); |
413 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), | 413 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), |
414 Immediate(Factory::pixel_array_map())); | 414 Immediate(Factory::pixel_array_map())); |
415 __ j(not_equal, &slow); | 415 __ j(not_equal, &slow); |
416 // Check that the value is a smi. If a conversion is needed call into the | 416 // Check that the value is a smi. If a conversion is needed call into the |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // ebx: index (as a smi) | 478 // ebx: index (as a smi) |
479 __ mov(Operand(ecx, ebx, times_2, FixedArray::kHeaderSize - kHeapObjectTag), | 479 __ mov(Operand(ecx, ebx, times_2, FixedArray::kHeaderSize - kHeapObjectTag), |
480 eax); | 480 eax); |
481 // Update write barrier for the elements array address. | 481 // Update write barrier for the elements array address. |
482 __ mov(edx, Operand(eax)); | 482 __ mov(edx, Operand(eax)); |
483 __ RecordWrite(ecx, 0, edx, ebx); | 483 __ RecordWrite(ecx, 0, edx, ebx); |
484 __ ret(0); | 484 __ ret(0); |
485 } | 485 } |
486 | 486 |
487 | 487 |
| 488 void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, |
| 489 ExternalArrayType array_type) { |
| 490 GenerateGeneric(masm); |
| 491 } |
| 492 |
| 493 |
488 // Defined in ic.cc. | 494 // Defined in ic.cc. |
489 Object* CallIC_Miss(Arguments args); | 495 Object* CallIC_Miss(Arguments args); |
490 | 496 |
491 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { | 497 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
492 // ----------- S t a t e ------------- | 498 // ----------- S t a t e ------------- |
493 // ----------------------------------- | 499 // ----------------------------------- |
494 Label number, non_number, non_string, boolean, probe, miss; | 500 Label number, non_number, non_string, boolean, probe, miss; |
495 | 501 |
496 // Get the receiver of the function from the stack; 1 ~ return address. | 502 // Get the receiver of the function from the stack; 1 ~ return address. |
497 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 503 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 | 1034 |
1029 // Do tail-call to runtime routine. | 1035 // Do tail-call to runtime routine. |
1030 __ TailCallRuntime( | 1036 __ TailCallRuntime( |
1031 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1037 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
1032 } | 1038 } |
1033 | 1039 |
1034 #undef __ | 1040 #undef __ |
1035 | 1041 |
1036 | 1042 |
1037 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
OLD | NEW |