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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 __ j(equal, miss_label); | 80 __ j(equal, miss_label); |
81 | 81 |
82 // Possible work-around for http://crbug.com/16276. | 82 // Possible work-around for http://crbug.com/16276. |
83 __ cmpb(r0, Immediate(JS_GLOBAL_OBJECT_TYPE)); | 83 __ cmpb(r0, Immediate(JS_GLOBAL_OBJECT_TYPE)); |
84 __ j(equal, miss_label); | 84 __ j(equal, miss_label); |
85 __ cmpb(r0, Immediate(JS_BUILTINS_OBJECT_TYPE)); | 85 __ cmpb(r0, Immediate(JS_BUILTINS_OBJECT_TYPE)); |
86 __ j(equal, miss_label); | 86 __ j(equal, miss_label); |
87 | 87 |
88 // Check that the properties array is a dictionary. | 88 // Check that the properties array is a dictionary. |
89 __ movq(r0, FieldOperand(r1, JSObject::kPropertiesOffset)); | 89 __ movq(r0, FieldOperand(r1, JSObject::kPropertiesOffset)); |
90 __ Cmp(FieldOperand(r0, HeapObject::kMapOffset), | 90 __ Cmp(FieldOperand(r0, HeapObject::kMapOffset), Factory::hash_table_map()); |
91 Factory::hash_table_map()); | |
92 __ j(not_equal, miss_label); | 91 __ j(not_equal, miss_label); |
93 | 92 |
94 // Compute the capacity mask. | 93 // Compute the capacity mask. |
95 const int kCapacityOffset = | 94 const int kCapacityOffset = |
96 StringDictionary::kHeaderSize + | 95 StringDictionary::kHeaderSize + |
97 StringDictionary::kCapacityIndex * kPointerSize; | 96 StringDictionary::kCapacityIndex * kPointerSize; |
98 __ movq(r2, FieldOperand(r0, kCapacityOffset)); | 97 __ movq(r2, FieldOperand(r0, kCapacityOffset)); |
99 __ shrl(r2, Immediate(kSmiTagSize)); // convert smi to int | 98 __ shrl(r2, Immediate(kSmiTagSize)); // convert smi to int |
100 __ decl(r2); | 99 __ decl(r2); |
101 | 100 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 __ j(not_zero, &slow); | 235 __ j(not_zero, &slow); |
237 | 236 |
238 // Check that the key is a smi. | 237 // Check that the key is a smi. |
239 __ testl(rax, Immediate(kSmiTagMask)); | 238 __ testl(rax, Immediate(kSmiTagMask)); |
240 __ j(not_zero, &check_string); | 239 __ j(not_zero, &check_string); |
241 __ sarl(rax, Immediate(kSmiTagSize)); | 240 __ sarl(rax, Immediate(kSmiTagSize)); |
242 // Get the elements array of the object. | 241 // Get the elements array of the object. |
243 __ bind(&index_int); | 242 __ bind(&index_int); |
244 __ movq(rcx, FieldOperand(rcx, JSObject::kElementsOffset)); | 243 __ movq(rcx, FieldOperand(rcx, JSObject::kElementsOffset)); |
245 // Check that the object is in fast mode (not dictionary). | 244 // Check that the object is in fast mode (not dictionary). |
246 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::hash_table_map()); | 245 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::fixed_array_map()); |
247 __ j(equal, &slow); | 246 __ j(not_equal, &slow); |
248 // Check that the key (index) is within bounds. | 247 // Check that the key (index) is within bounds. |
249 __ cmpl(rax, FieldOperand(rcx, FixedArray::kLengthOffset)); | 248 __ cmpl(rax, FieldOperand(rcx, FixedArray::kLengthOffset)); |
250 __ j(below, &fast); // Unsigned comparison rejects negative indices. | 249 __ j(below, &fast); // Unsigned comparison rejects negative indices. |
251 // Slow case: Load name and receiver from stack and jump to runtime. | 250 // Slow case: Load name and receiver from stack and jump to runtime. |
252 __ bind(&slow); | 251 __ bind(&slow); |
253 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); | 252 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); |
254 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 253 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
255 __ bind(&check_string); | 254 __ bind(&check_string); |
256 // The key is not a smi. | 255 // The key is not a smi. |
257 // Is it a string? | 256 // Is it a string? |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Check that the object is some kind of JS object. | 379 // Check that the object is some kind of JS object. |
381 __ CmpInstanceType(rcx, FIRST_JS_OBJECT_TYPE); | 380 __ CmpInstanceType(rcx, FIRST_JS_OBJECT_TYPE); |
382 __ j(below, &slow); | 381 __ j(below, &slow); |
383 | 382 |
384 // Object case: Check key against length in the elements array. | 383 // Object case: Check key against length in the elements array. |
385 // rax: value | 384 // rax: value |
386 // rdx: JSObject | 385 // rdx: JSObject |
387 // rbx: index (as a smi) | 386 // rbx: index (as a smi) |
388 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); | 387 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
389 // Check that the object is in fast mode (not dictionary). | 388 // Check that the object is in fast mode (not dictionary). |
390 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::hash_table_map()); | 389 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::fixed_array_map()); |
391 __ j(equal, &slow); | 390 __ j(not_equal, &slow); |
392 // Untag the key (for checking against untagged length in the fixed array). | 391 // Untag the key (for checking against untagged length in the fixed array). |
393 __ movl(rdx, rbx); | 392 __ movl(rdx, rbx); |
394 __ sarl(rdx, Immediate(kSmiTagSize)); | 393 __ sarl(rdx, Immediate(kSmiTagSize)); |
395 __ cmpl(rdx, FieldOperand(rcx, Array::kLengthOffset)); | 394 __ cmpl(rdx, FieldOperand(rcx, Array::kLengthOffset)); |
396 // rax: value | 395 // rax: value |
397 // rcx: FixedArray | 396 // rcx: FixedArray |
398 // rbx: index (as a smi) | 397 // rbx: index (as a smi) |
399 __ j(below, &fast); | 398 __ j(below, &fast); |
400 | 399 |
401 | 400 |
(...skipping 29 matching lines...) Expand all Loading... |
431 | 430 |
432 | 431 |
433 // Array case: Get the length and the elements array from the JS | 432 // Array case: Get the length and the elements array from the JS |
434 // array. Check that the array is in fast mode; if it is the | 433 // array. Check that the array is in fast mode; if it is the |
435 // length is always a smi. | 434 // length is always a smi. |
436 __ bind(&array); | 435 __ bind(&array); |
437 // rax: value | 436 // rax: value |
438 // rdx: JSArray | 437 // rdx: JSArray |
439 // rbx: index (as a smi) | 438 // rbx: index (as a smi) |
440 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); | 439 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
441 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::hash_table_map()); | 440 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), Factory::fixed_array_map()); |
442 __ j(equal, &slow); | 441 __ j(not_equal, &slow); |
443 | 442 |
444 // Check the key against the length in the array, compute the | 443 // Check the key against the length in the array, compute the |
445 // address to store into and fall through to fast case. | 444 // address to store into and fall through to fast case. |
446 __ cmpl(rbx, FieldOperand(rdx, JSArray::kLengthOffset)); | 445 __ cmpl(rbx, FieldOperand(rdx, JSArray::kLengthOffset)); |
447 __ j(above_equal, &extra); | 446 __ j(above_equal, &extra); |
448 | 447 |
449 | 448 |
450 // Fast case: Do the store. | 449 // Fast case: Do the store. |
451 __ bind(&fast); | 450 __ bind(&fast); |
452 // rax: value | 451 // rax: value |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 646 |
648 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 647 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
649 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); | 648 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
650 } | 649 } |
651 | 650 |
652 | 651 |
653 #undef __ | 652 #undef __ |
654 | 653 |
655 | 654 |
656 } } // namespace v8::internal | 655 } } // namespace v8::internal |
OLD | NEW |