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

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

Issue 6992072: Implement set trap for proxies, and revamp class hierarchy in preparation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 9 years, 6 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/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 VisitForAccumulatorValue(stmt->enumerable()); 873 VisitForAccumulatorValue(stmt->enumerable());
874 __ cmp(eax, isolate()->factory()->undefined_value()); 874 __ cmp(eax, isolate()->factory()->undefined_value());
875 __ j(equal, &exit); 875 __ j(equal, &exit);
876 __ cmp(eax, isolate()->factory()->null_value()); 876 __ cmp(eax, isolate()->factory()->null_value());
877 __ j(equal, &exit); 877 __ j(equal, &exit);
878 878
879 // Convert the object to a JS object. 879 // Convert the object to a JS object.
880 Label convert, done_convert; 880 Label convert, done_convert;
881 __ test(eax, Immediate(kSmiTagMask)); 881 __ test(eax, Immediate(kSmiTagMask));
882 __ j(zero, &convert, Label::kNear); 882 __ j(zero, &convert, Label::kNear);
883 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); 883 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
884 __ j(above_equal, &done_convert, Label::kNear); 884 __ j(above_equal, &done_convert, Label::kNear);
885 __ bind(&convert); 885 __ bind(&convert);
886 __ push(eax); 886 __ push(eax);
887 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 887 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
888 __ bind(&done_convert); 888 __ bind(&done_convert);
889 __ push(eax); 889 __ push(eax);
890 890
891 // Check cache validity in generated code. This is a fast case for 891 // Check cache validity in generated code. This is a fast case for
892 // the JSObject::IsSimpleEnum cache validity checks. If we cannot 892 // the JSObject::IsSimpleEnum cache validity checks. If we cannot
893 // guarantee cache validity, call the runtime system to check cache 893 // guarantee cache validity, call the runtime system to check cache
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2396 __ test(eax, Immediate(kSmiTagMask)); 2396 __ test(eax, Immediate(kSmiTagMask));
2397 __ j(zero, if_false); 2397 __ j(zero, if_false);
2398 __ cmp(eax, isolate()->factory()->null_value()); 2398 __ cmp(eax, isolate()->factory()->null_value());
2399 __ j(equal, if_true); 2399 __ j(equal, if_true);
2400 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 2400 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
2401 // Undetectable objects behave like undefined when tested with typeof. 2401 // Undetectable objects behave like undefined when tested with typeof.
2402 __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset)); 2402 __ movzx_b(ecx, FieldOperand(ebx, Map::kBitFieldOffset));
2403 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); 2403 __ test(ecx, Immediate(1 << Map::kIsUndetectable));
2404 __ j(not_zero, if_false); 2404 __ j(not_zero, if_false);
2405 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 2405 __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceTypeOffset));
2406 __ cmp(ecx, FIRST_JS_OBJECT_TYPE); 2406 __ cmp(ecx, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
2407 __ j(below, if_false); 2407 __ j(below, if_false);
2408 __ cmp(ecx, LAST_JS_OBJECT_TYPE); 2408 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
2409 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 2409 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
2410 Split(below_equal, if_true, if_false, fall_through); 2410 Split(below_equal, if_true, if_false, fall_through);
2411 2411
2412 context()->Plug(if_true, if_false); 2412 context()->Plug(if_true, if_false);
2413 } 2413 }
2414 2414
2415 2415
2416 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) { 2416 void FullCodeGenerator::EmitIsSpecObject(ZoneList<Expression*>* args) {
2417 ASSERT(args->length() == 1); 2417 ASSERT(args->length() == 1);
2418 2418
2419 VisitForAccumulatorValue(args->at(0)); 2419 VisitForAccumulatorValue(args->at(0));
2420 2420
2421 Label materialize_true, materialize_false; 2421 Label materialize_true, materialize_false;
2422 Label* if_true = NULL; 2422 Label* if_true = NULL;
2423 Label* if_false = NULL; 2423 Label* if_false = NULL;
2424 Label* fall_through = NULL; 2424 Label* fall_through = NULL;
2425 context()->PrepareTest(&materialize_true, &materialize_false, 2425 context()->PrepareTest(&materialize_true, &materialize_false,
2426 &if_true, &if_false, &fall_through); 2426 &if_true, &if_false, &fall_through);
2427 2427
2428 __ test(eax, Immediate(kSmiTagMask)); 2428 __ test(eax, Immediate(kSmiTagMask));
2429 __ j(equal, if_false); 2429 __ j(equal, if_false);
2430 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ebx); 2430 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ebx);
2431 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 2431 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
2432 Split(above_equal, if_true, if_false, fall_through); 2432 Split(above_equal, if_true, if_false, fall_through);
2433 2433
2434 context()->Plug(if_true, if_false); 2434 context()->Plug(if_true, if_false);
2435 } 2435 }
2436 2436
2437 2437
2438 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) { 2438 void FullCodeGenerator::EmitIsUndetectableObject(ZoneList<Expression*>* args) {
2439 ASSERT(args->length() == 1); 2439 ASSERT(args->length() == 1);
2440 2440
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 Label done, null, function, non_function_constructor; 2706 Label done, null, function, non_function_constructor;
2707 2707
2708 VisitForAccumulatorValue(args->at(0)); 2708 VisitForAccumulatorValue(args->at(0));
2709 2709
2710 // If the object is a smi, we return null. 2710 // If the object is a smi, we return null.
2711 __ test(eax, Immediate(kSmiTagMask)); 2711 __ test(eax, Immediate(kSmiTagMask));
2712 __ j(zero, &null); 2712 __ j(zero, &null);
2713 2713
2714 // Check that the object is a JS object but take special care of JS 2714 // Check that the object is a JS object but take special care of JS
2715 // functions to make sure they have 'Function' as their class. 2715 // functions to make sure they have 'Function' as their class.
2716 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, eax); // Map is now in eax. 2716 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, eax);
2717 // Map is now in eax.
2717 __ j(below, &null); 2718 __ j(below, &null);
2718 2719
2719 // As long as JS_FUNCTION_TYPE is the last instance type and it is 2720 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and
2720 // right after LAST_JS_OBJECT_TYPE, we can avoid checking for 2721 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
2721 // LAST_JS_OBJECT_TYPE. 2722 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
2722 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); 2723 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
2723 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); 2724 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
2724 __ CmpInstanceType(eax, JS_FUNCTION_TYPE); 2725 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
2725 __ j(equal, &function); 2726 __ CmpInstanceType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE);
2727 __ j(above_equal, &function);
2726 2728
2727 // Check if the constructor in the map is a function. 2729 // Check if the constructor in the map is a function.
2728 __ mov(eax, FieldOperand(eax, Map::kConstructorOffset)); 2730 __ mov(eax, FieldOperand(eax, Map::kConstructorOffset));
2729 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 2731 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
2730 __ j(not_equal, &non_function_constructor); 2732 __ j(not_equal, &non_function_constructor);
2731 2733
2732 // eax now contains the constructor function. Grab the 2734 // eax now contains the constructor function. Grab the
2733 // instance class name from there. 2735 // instance class name from there.
2734 __ mov(eax, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); 2736 __ mov(eax, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset));
2735 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kInstanceClassNameOffset)); 2737 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kInstanceClassNameOffset));
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4056 __ cmp(eax, isolate()->factory()->undefined_value()); 4058 __ cmp(eax, isolate()->factory()->undefined_value());
4057 __ j(equal, if_true); 4059 __ j(equal, if_true);
4058 __ JumpIfSmi(eax, if_false); 4060 __ JumpIfSmi(eax, if_false);
4059 // Check for undetectable objects => true. 4061 // Check for undetectable objects => true.
4060 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); 4062 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset));
4061 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset)); 4063 __ movzx_b(ecx, FieldOperand(edx, Map::kBitFieldOffset));
4062 __ test(ecx, Immediate(1 << Map::kIsUndetectable)); 4064 __ test(ecx, Immediate(1 << Map::kIsUndetectable));
4063 Split(not_zero, if_true, if_false, fall_through); 4065 Split(not_zero, if_true, if_false, fall_through);
4064 } else if (check->Equals(isolate()->heap()->function_symbol())) { 4066 } else if (check->Equals(isolate()->heap()->function_symbol())) {
4065 __ JumpIfSmi(eax, if_false); 4067 __ JumpIfSmi(eax, if_false);
4066 __ CmpObjectType(eax, FIRST_FUNCTION_CLASS_TYPE, edx); 4068 __ CmpObjectType(eax, FIRST_CALLABLE_SPEC_OBJECT_TYPE, edx);
4067 Split(above_equal, if_true, if_false, fall_through); 4069 Split(above_equal, if_true, if_false, fall_through);
4068 } else if (check->Equals(isolate()->heap()->object_symbol())) { 4070 } else if (check->Equals(isolate()->heap()->object_symbol())) {
4069 __ JumpIfSmi(eax, if_false); 4071 __ JumpIfSmi(eax, if_false);
4070 __ cmp(eax, isolate()->factory()->null_value()); 4072 __ cmp(eax, isolate()->factory()->null_value());
4071 __ j(equal, if_true); 4073 __ j(equal, if_true);
4072 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, edx); 4074 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx);
4073 __ j(below, if_false); 4075 __ j(below, if_false);
4074 __ CmpInstanceType(edx, FIRST_FUNCTION_CLASS_TYPE); 4076 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
4075 __ j(above_equal, if_false); 4077 __ j(above, if_false);
4076 // Check for undetectable objects => false. 4078 // Check for undetectable objects => false.
4077 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), 4079 __ test_b(FieldOperand(edx, Map::kBitFieldOffset),
4078 1 << Map::kIsUndetectable); 4080 1 << Map::kIsUndetectable);
4079 Split(zero, if_true, if_false, fall_through); 4081 Split(zero, if_true, if_false, fall_through);
4080 } else { 4082 } else {
4081 if (if_false != fall_through) __ jmp(if_false); 4083 if (if_false != fall_through) __ jmp(if_false);
4082 } 4084 }
4083 4085
4084 return true; 4086 return true;
4085 } 4087 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 // And return. 4337 // And return.
4336 __ ret(0); 4338 __ ret(0);
4337 } 4339 }
4338 4340
4339 4341
4340 #undef __ 4342 #undef __
4341 4343
4342 } } // namespace v8::internal 4344 } } // namespace v8::internal
4343 4345
4344 #endif // V8_TARGET_ARCH_IA32 4346 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698