| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 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 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2662             1 << Map::kStringWrapperSafeForDefaultValueOf); |  2662             1 << Map::kStringWrapperSafeForDefaultValueOf); | 
|  2663   __ j(not_zero, if_true); |  2663   __ j(not_zero, if_true); | 
|  2664  |  2664  | 
|  2665   // Check for fast case object. Return false for slow case objects. |  2665   // Check for fast case object. Return false for slow case objects. | 
|  2666   __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); |  2666   __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); | 
|  2667   __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); |  2667   __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); | 
|  2668   __ cmp(ecx, FACTORY->hash_table_map()); |  2668   __ cmp(ecx, FACTORY->hash_table_map()); | 
|  2669   __ j(equal, if_false); |  2669   __ j(equal, if_false); | 
|  2670  |  2670  | 
|  2671   // Look for valueOf symbol in the descriptor array, and indicate false if |  2671   // Look for valueOf symbol in the descriptor array, and indicate false if | 
|  2672   // found. Since we omit an enumeration index check, if it is added via a |  2672   // found. The type is not checked, so if it is a transition it is a false | 
|  2673   // transition that shares its descriptor array, this is a false positive. |  2673   // negative. | 
|  2674   Label entry, loop, done; |  | 
|  2675  |  | 
|  2676   // Skip loop if no descriptors are valid. |  | 
|  2677   __ NumberOfOwnDescriptors(ecx, ebx); |  | 
|  2678   __ cmp(ecx, 0); |  | 
|  2679   __ j(equal, &done); |  | 
|  2680  |  | 
|  2681   __ LoadInstanceDescriptors(ebx, ebx); |  2674   __ LoadInstanceDescriptors(ebx, ebx); | 
|  2682   // ebx: descriptor array. |  2675   __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 
|  2683   // ecx: valid entries in the descriptor array. |  2676   // ebx: descriptor array | 
 |  2677   // ecx: length of descriptor array | 
|  2684   // Calculate the end of the descriptor array. |  2678   // Calculate the end of the descriptor array. | 
|  2685   STATIC_ASSERT(kSmiTag == 0); |  2679   STATIC_ASSERT(kSmiTag == 0); | 
|  2686   STATIC_ASSERT(kSmiTagSize == 1); |  2680   STATIC_ASSERT(kSmiTagSize == 1); | 
|  2687   STATIC_ASSERT(kPointerSize == 4); |  2681   STATIC_ASSERT(kPointerSize == 4); | 
|  2688   __ imul(ecx, ecx, DescriptorArray::kDescriptorSize); |  2682   __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); | 
|  2689   __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset)); |  | 
|  2690   // Calculate location of the first key name. |  2683   // Calculate location of the first key name. | 
|  2691   __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); |  2684   __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); | 
|  2692   // Loop through all the keys in the descriptor array. If one of these is the |  2685   // Loop through all the keys in the descriptor array. If one of these is the | 
|  2693   // symbol valueOf the result is false. |  2686   // symbol valueOf the result is false. | 
 |  2687   Label entry, loop; | 
|  2694   __ jmp(&entry); |  2688   __ jmp(&entry); | 
|  2695   __ bind(&loop); |  2689   __ bind(&loop); | 
|  2696   __ mov(edx, FieldOperand(ebx, 0)); |  2690   __ mov(edx, FieldOperand(ebx, 0)); | 
|  2697   __ cmp(edx, FACTORY->value_of_symbol()); |  2691   __ cmp(edx, FACTORY->value_of_symbol()); | 
|  2698   __ j(equal, if_false); |  2692   __ j(equal, if_false); | 
|  2699   __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); |  2693   __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); | 
|  2700   __ bind(&entry); |  2694   __ bind(&entry); | 
|  2701   __ cmp(ebx, ecx); |  2695   __ cmp(ebx, ecx); | 
|  2702   __ j(not_equal, &loop); |  2696   __ j(not_equal, &loop); | 
|  2703  |  2697  | 
|  2704   __ bind(&done); |  | 
|  2705  |  | 
|  2706   // Reload map as register ebx was used as temporary above. |  2698   // Reload map as register ebx was used as temporary above. | 
|  2707   __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |  2699   __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 
|  2708  |  2700  | 
|  2709   // If a valueOf property is not found on the object check that its |  2701   // If a valueOf property is not found on the object check that it's | 
|  2710   // prototype is the un-modified String prototype. If not result is false. |  2702   // prototype is the un-modified String prototype. If not result is false. | 
|  2711   __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |  2703   __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 
|  2712   __ JumpIfSmi(ecx, if_false); |  2704   __ JumpIfSmi(ecx, if_false); | 
|  2713   __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); |  2705   __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); | 
|  2714   __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |  2706   __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 
|  2715   __ mov(edx, |  2707   __ mov(edx, | 
|  2716          FieldOperand(edx, GlobalObject::kNativeContextOffset)); |  2708          FieldOperand(edx, GlobalObject::kNativeContextOffset)); | 
|  2717   __ cmp(ecx, |  2709   __ cmp(ecx, | 
|  2718          ContextOperand(edx, |  2710          ContextOperand(edx, | 
|  2719                         Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |  2711                         Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 
| (...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4563   *stack_depth = 0; |  4555   *stack_depth = 0; | 
|  4564   *context_length = 0; |  4556   *context_length = 0; | 
|  4565   return previous_; |  4557   return previous_; | 
|  4566 } |  4558 } | 
|  4567  |  4559  | 
|  4568 #undef __ |  4560 #undef __ | 
|  4569  |  4561  | 
|  4570 } }  // namespace v8::internal |  4562 } }  // namespace v8::internal | 
|  4571  |  4563  | 
|  4572 #endif  // V8_TARGET_ARCH_IA32 |  4564 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |