| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // Check that the key (index) is within bounds. | 263 // Check that the key (index) is within bounds. |
| 264 __ cmp(eax, FieldOperand(ecx, FixedArray::kLengthOffset)); | 264 __ cmp(eax, FieldOperand(ecx, FixedArray::kLengthOffset)); |
| 265 __ j(above_equal, &slow); | 265 __ j(above_equal, &slow); |
| 266 // Fast case: Do the load. | 266 // Fast case: Do the load. |
| 267 __ mov(eax, | 267 __ mov(eax, |
| 268 Operand(ecx, eax, times_4, FixedArray::kHeaderSize - kHeapObjectTag)); | 268 Operand(ecx, eax, times_4, FixedArray::kHeaderSize - kHeapObjectTag)); |
| 269 __ cmp(Operand(eax), Immediate(Factory::the_hole_value())); | 269 __ cmp(Operand(eax), Immediate(Factory::the_hole_value())); |
| 270 // In case the loaded value is the_hole we have to consult GetProperty | 270 // In case the loaded value is the_hole we have to consult GetProperty |
| 271 // to ensure the prototype chain is searched. | 271 // to ensure the prototype chain is searched. |
| 272 __ j(equal, &slow); | 272 __ j(equal, &slow); |
| 273 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1); | 273 __ IncrementCounter(&COUNTER(keyed_load_generic_smi), 1); |
| 274 __ ret(0); | 274 __ ret(0); |
| 275 | 275 |
| 276 // Check whether the elements is a pixel array. | 276 // Check whether the elements is a pixel array. |
| 277 // eax: untagged index | 277 // eax: untagged index |
| 278 // ecx: elements array | 278 // ecx: elements array |
| 279 __ bind(&check_pixel_array); | 279 __ bind(&check_pixel_array); |
| 280 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), | 280 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), |
| 281 Immediate(Factory::pixel_array_map())); | 281 Immediate(Factory::pixel_array_map())); |
| 282 __ j(not_equal, &slow); | 282 __ j(not_equal, &slow); |
| 283 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset)); | 283 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset)); |
| 284 __ j(above_equal, &slow); | 284 __ j(above_equal, &slow); |
| 285 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); | 285 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); |
| 286 __ movzx_b(eax, Operand(ecx, eax, times_1, 0)); | 286 __ movzx_b(eax, Operand(ecx, eax, times_1, 0)); |
| 287 __ shl(eax, kSmiTagSize); | 287 __ shl(eax, kSmiTagSize); |
| 288 __ ret(0); | 288 __ ret(0); |
| 289 | 289 |
| 290 // Slow case: Load name and receiver from stack and jump to runtime. | 290 // Slow case: Load name and receiver from stack and jump to runtime. |
| 291 __ bind(&slow); | 291 __ bind(&slow); |
| 292 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); | 292 __ IncrementCounter(&COUNTER(keyed_load_generic_slow), 1); |
| 293 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 293 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
| 294 | 294 |
| 295 __ bind(&check_string); | 295 __ bind(&check_string); |
| 296 // The key is not a smi. | 296 // The key is not a smi. |
| 297 // Is it a string? | 297 // Is it a string? |
| 298 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); | 298 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); |
| 299 __ j(above_equal, &slow); | 299 __ j(above_equal, &slow); |
| 300 // Is the string an array index, with cached numeric value? | 300 // Is the string an array index, with cached numeric value? |
| 301 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset)); | 301 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset)); |
| 302 __ test(ebx, Immediate(String::kIsArrayIndexMask)); | 302 __ test(ebx, Immediate(String::kIsArrayIndexMask)); |
| 303 __ j(not_zero, &index_string, not_taken); | 303 __ j(not_zero, &index_string, not_taken); |
| 304 | 304 |
| 305 // If the string is a symbol, do a quick inline probe of the receiver's | 305 // If the string is a symbol, do a quick inline probe of the receiver's |
| 306 // dictionary, if it exists. | 306 // dictionary, if it exists. |
| 307 __ movzx_b(ebx, FieldOperand(edx, Map::kInstanceTypeOffset)); | 307 __ movzx_b(ebx, FieldOperand(edx, Map::kInstanceTypeOffset)); |
| 308 __ test(ebx, Immediate(kIsSymbolMask)); | 308 __ test(ebx, Immediate(kIsSymbolMask)); |
| 309 __ j(zero, &slow, not_taken); | 309 __ j(zero, &slow, not_taken); |
| 310 // Probe the dictionary leaving result in ecx. | 310 // Probe the dictionary leaving result in ecx. |
| 311 GenerateDictionaryLoad(masm, &slow, ebx, ecx, edx, eax); | 311 GenerateDictionaryLoad(masm, &slow, ebx, ecx, edx, eax); |
| 312 GenerateCheckNonObjectOrLoaded(masm, &slow, ecx, edx); | 312 GenerateCheckNonObjectOrLoaded(masm, &slow, ecx, edx); |
| 313 __ mov(eax, Operand(ecx)); | 313 __ mov(eax, Operand(ecx)); |
| 314 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); | 314 __ IncrementCounter(&COUNTER(keyed_load_generic_symbol), 1); |
| 315 __ ret(0); | 315 __ ret(0); |
| 316 // If the hash field contains an array index pick it out. The assert checks | 316 // If the hash field contains an array index pick it out. The assert checks |
| 317 // that the constants for the maximum number of digits for an array index | 317 // that the constants for the maximum number of digits for an array index |
| 318 // cached in the hash field and the number of bits reserved for it does not | 318 // cached in the hash field and the number of bits reserved for it does not |
| 319 // conflict. | 319 // conflict. |
| 320 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 320 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
| 321 (1 << String::kArrayIndexValueBits)); | 321 (1 << String::kArrayIndexValueBits)); |
| 322 __ bind(&index_string); | 322 __ bind(&index_string); |
| 323 __ mov(eax, Operand(ebx)); | 323 __ mov(eax, Operand(ebx)); |
| 324 __ and_(eax, String::kArrayIndexHashMask); | 324 __ and_(eax, String::kArrayIndexHashMask); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 // If we fail allocation of the HeapNumber, we still have a value on | 476 // If we fail allocation of the HeapNumber, we still have a value on |
| 477 // top of the FPU stack. Remove it. | 477 // top of the FPU stack. Remove it. |
| 478 __ bind(&failed_allocation); | 478 __ bind(&failed_allocation); |
| 479 __ ffree(); | 479 __ ffree(); |
| 480 __ fincstp(); | 480 __ fincstp(); |
| 481 // Fall through to slow case. | 481 // Fall through to slow case. |
| 482 | 482 |
| 483 // Slow case: Load name and receiver from stack and jump to runtime. | 483 // Slow case: Load name and receiver from stack and jump to runtime. |
| 484 __ bind(&slow); | 484 __ bind(&slow); |
| 485 __ IncrementCounter(&Counters::keyed_load_external_array_slow, 1); | 485 __ IncrementCounter(&COUNTER(keyed_load_external_array_slow), 1); |
| 486 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 486 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
| 487 } | 487 } |
| 488 | 488 |
| 489 | 489 |
| 490 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 490 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
| 491 // ----------- S t a t e ------------- | 491 // ----------- S t a t e ------------- |
| 492 // -- eax : value | 492 // -- eax : value |
| 493 // -- esp[0] : return address | 493 // -- esp[0] : return address |
| 494 // -- esp[4] : key | 494 // -- esp[4] : key |
| 495 // -- esp[8] : receiver | 495 // -- esp[8] : receiver |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1362 |
| 1363 // Do tail-call to runtime routine. | 1363 // Do tail-call to runtime routine. |
| 1364 __ TailCallRuntime( | 1364 __ TailCallRuntime( |
| 1365 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); | 1365 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 #undef __ | 1368 #undef __ |
| 1369 | 1369 |
| 1370 | 1370 |
| 1371 } } // namespace v8::internal | 1371 } } // namespace v8::internal |
| OLD | NEW |