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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 384 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
385 (1 << String::kArrayIndexValueBits)); | 385 (1 << String::kArrayIndexValueBits)); |
386 __ bind(&index_string); | 386 __ bind(&index_string); |
387 __ mov(eax, Operand(ebx)); | 387 __ mov(eax, Operand(ebx)); |
388 __ and_(eax, String::kArrayIndexHashMask); | 388 __ and_(eax, String::kArrayIndexHashMask); |
389 __ shr(eax, String::kHashShift); | 389 __ shr(eax, String::kHashShift); |
390 __ jmp(&index_int); | 390 __ jmp(&index_int); |
391 } | 391 } |
392 | 392 |
393 | 393 |
| 394 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
| 395 // ----------- S t a t e ------------- |
| 396 // -- esp[0] : return address |
| 397 // -- esp[4] : key |
| 398 // -- esp[8] : receiver |
| 399 // ----------------------------------- |
| 400 Label miss, index_ok; |
| 401 |
| 402 // Pop return address. |
| 403 // Performing the load early is better in the common case. |
| 404 __ pop(eax); |
| 405 |
| 406 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
| 407 __ test(ebx, Immediate(kSmiTagMask)); |
| 408 __ j(zero, &miss); |
| 409 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); |
| 410 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 411 __ test(ecx, Immediate(kIsNotStringMask)); |
| 412 __ j(not_zero, &miss); |
| 413 |
| 414 // Check if key is a smi or a heap number. |
| 415 __ mov(edx, Operand(esp, 0)); |
| 416 __ test(edx, Immediate(kSmiTagMask)); |
| 417 __ j(zero, &index_ok); |
| 418 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); |
| 419 __ cmp(ecx, Factory::heap_number_map()); |
| 420 __ j(not_equal, &miss); |
| 421 |
| 422 __ bind(&index_ok); |
| 423 // Duplicate receiver and key since they are expected on the stack after |
| 424 // the KeyedLoadIC call. |
| 425 __ push(ebx); // receiver |
| 426 __ push(edx); // key |
| 427 __ push(eax); // return address |
| 428 __ InvokeBuiltin(Builtins::STRING_CHAR_AT, JUMP_FUNCTION); |
| 429 |
| 430 __ bind(&miss); |
| 431 __ push(eax); |
| 432 GenerateMiss(masm); |
| 433 } |
| 434 |
| 435 |
394 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, | 436 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
395 ExternalArrayType array_type) { | 437 ExternalArrayType array_type) { |
396 // ----------- S t a t e ------------- | 438 // ----------- S t a t e ------------- |
397 // -- esp[0] : return address | 439 // -- esp[0] : return address |
398 // -- esp[4] : key | 440 // -- esp[4] : key |
399 // -- esp[8] : receiver | 441 // -- esp[8] : receiver |
400 // ----------------------------------- | 442 // ----------------------------------- |
401 Label slow, failed_allocation; | 443 Label slow, failed_allocation; |
402 | 444 |
403 // Load name and receiver. | 445 // Load name and receiver. |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 | 1481 |
1440 // Do tail-call to runtime routine. | 1482 // Do tail-call to runtime routine. |
1441 __ TailCallRuntime( | 1483 __ TailCallRuntime( |
1442 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1484 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
1443 } | 1485 } |
1444 | 1486 |
1445 #undef __ | 1487 #undef __ |
1446 | 1488 |
1447 | 1489 |
1448 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
OLD | NEW |