Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 7737036: Reorganize object type enum, such that proxies are no longer in the middle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Erik's comments. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 ASSERT(args->length() == 1); 2640 ASSERT(args->length() == 1);
2641 Label done, null, function, non_function_constructor; 2641 Label done, null, function, non_function_constructor;
2642 2642
2643 VisitForAccumulatorValue(args->at(0)); 2643 VisitForAccumulatorValue(args->at(0));
2644 2644
2645 // If the object is a smi, we return null. 2645 // If the object is a smi, we return null.
2646 __ JumpIfSmi(eax, &null); 2646 __ JumpIfSmi(eax, &null);
2647 2647
2648 // Check that the object is a JS object but take special care of JS 2648 // Check that the object is a JS object but take special care of JS
2649 // functions to make sure they have 'Function' as their class. 2649 // functions to make sure they have 'Function' as their class.
2650 // Assume that there are only two callable types, and one of them is at
2651 // either end of the type range for JS object types. Saves extra comparisons.
2652 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2650 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, eax); 2653 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, eax);
2651 // Map is now in eax. 2654 // Map is now in eax.
2652 __ j(below, &null); 2655 __ j(below, &null);
2656 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2657 FIRST_SPEC_OBJECT_TYPE + 1);
2658 __ j(equal, &function);
2653 2659
2654 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and 2660 __ CmpInstanceType(eax, LAST_SPEC_OBJECT_TYPE);
2655 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after 2661 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2656 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter. 2662 LAST_SPEC_OBJECT_TYPE - 1);
2657 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); 2663 __ j(equal, &function);
2658 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE == 2664 // Assume that there is no larger type.
2659 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1); 2665 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1);
2660 __ CmpInstanceType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE);
2661 __ j(above_equal, &function);
2662 2666
2663 // Check if the constructor in the map is a function. 2667 // Check if the constructor in the map is a JS function.
2664 __ mov(eax, FieldOperand(eax, Map::kConstructorOffset)); 2668 __ mov(eax, FieldOperand(eax, Map::kConstructorOffset));
2665 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 2669 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
2666 __ j(not_equal, &non_function_constructor); 2670 __ j(not_equal, &non_function_constructor);
2667 2671
2668 // eax now contains the constructor function. Grab the 2672 // eax now contains the constructor function. Grab the
2669 // instance class name from there. 2673 // instance class name from there.
2670 __ mov(eax, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); 2674 __ mov(eax, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset));
2671 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kInstanceClassNameOffset)); 2675 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kInstanceClassNameOffset));
2672 __ jmp(&done); 2676 __ jmp(&done);
2673 2677
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
3991 __ cmp(eax, isolate()->factory()->undefined_value()); 3995 __ cmp(eax, isolate()->factory()->undefined_value());
3992 __ j(equal, if_true); 3996 __ j(equal, if_true);
3993 __ JumpIfSmi(eax, if_false); 3997 __ JumpIfSmi(eax, if_false);
3994 // Check for undetectable objects => true. 3998 // Check for undetectable objects => true.
3995 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); 3999 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
3996 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); 4000 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset));
3997 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); 4001 __ test(ecx, Immediate(1 << Map::kIsUndetectable));
3998 Split(not_zero, if_true, if_false, fall_through); 4002 Split(not_zero, if_true, if_false, fall_through);
3999 } else if (check->Equals(isolate()->heap()->function_symbol())) { 4003 } else if (check->Equals(isolate()->heap()->function_symbol())) {
4000 __ JumpIfSmi(eax, if_false); 4004 __ JumpIfSmi(eax, if_false);
4001 __ CmpObjectType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE, edx); 4005 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
4002 Split(above_equal, if_true, if_false, fall_through); 4006 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx);
4007 __ j(equal, if_true);
4008 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE);
4009 Split(equal, if_true, if_false, fall_through);
4003 } else if (check->Equals(isolate()->heap()->object_symbol())) { 4010 } else if (check->Equals(isolate()->heap()->object_symbol())) {
4004 __ JumpIfSmi(eax, if_false); 4011 __ JumpIfSmi(eax, if_false);
4005 if (!FLAG_harmony_typeof) { 4012 if (!FLAG_harmony_typeof) {
4006 __ cmp(eax, isolate()->factory()->null_value()); 4013 __ cmp(eax, isolate()->factory()->null_value());
4007 __ j(equal, if_true); 4014 __ j(equal, if_true);
4008 } 4015 }
4009 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); 4016 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx);
4010 __ j(below, if_false); 4017 __ j(below, if_false);
4011 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 4018 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
4012 __ j(above, if_false); 4019 __ j(above, if_false);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
4276 *context_length = 0; 4283 *context_length = 0;
4277 return previous_; 4284 return previous_;
4278 } 4285 }
4279 4286
4280 4287
4281 #undef __ 4288 #undef __
4282 4289
4283 } } // namespace v8::internal 4290 } } // namespace v8::internal
4284 4291
4285 #endif // V8_TARGET_ARCH_IA32 4292 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698