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

Side by Side Diff: src/ia32/builtins-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: Renamed range constants for InstanceType enum. Created 9 years, 7 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
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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // If the result is an object (in the ECMA sense), we should get rid 352 // If the result is an object (in the ECMA sense), we should get rid
353 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 353 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
354 // on page 74. 354 // on page 74.
355 Label use_receiver, exit; 355 Label use_receiver, exit;
356 356
357 // If the result is a smi, it is *not* an object in the ECMA sense. 357 // If the result is a smi, it is *not* an object in the ECMA sense.
358 __ test(eax, Immediate(kSmiTagMask)); 358 __ test(eax, Immediate(kSmiTagMask));
359 __ j(zero, &use_receiver); 359 __ j(zero, &use_receiver);
360 360
361 // If the type of the result (stored in its map) is less than 361 // If the type of the result (stored in its map) is less than
362 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. 362 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
363 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); 363 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
364 __ j(above_equal, &exit); 364 __ j(above_equal, &exit);
365 365
366 // Throw away the result of the constructor invocation and use the 366 // Throw away the result of the constructor invocation and use the
367 // on-stack receiver as the result. 367 // on-stack receiver as the result.
368 __ bind(&use_receiver); 368 __ bind(&use_receiver);
369 __ mov(eax, Operand(esp, 0)); 369 __ mov(eax, Operand(esp, 0));
370 370
371 // Restore the arguments count and leave the construct frame. 371 // Restore the arguments count and leave the construct frame.
372 __ bind(&exit); 372 __ bind(&exit);
373 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count 373 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 __ j(zero, &convert_to_object); 610 __ j(zero, &convert_to_object);
611 611
612 __ cmp(ebx, factory->null_value()); 612 __ cmp(ebx, factory->null_value());
613 __ j(equal, &use_global_receiver); 613 __ j(equal, &use_global_receiver);
614 __ cmp(ebx, factory->undefined_value()); 614 __ cmp(ebx, factory->undefined_value());
615 __ j(equal, &use_global_receiver); 615 __ j(equal, &use_global_receiver);
616 616
617 // We don't use IsObjectJSObjectType here because we jump on success. 617 // We don't use IsObjectJSObjectType here because we jump on success.
618 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); 618 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
619 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 619 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
620 __ sub(Operand(ecx), Immediate(FIRST_JS_OBJECT_TYPE)); 620 __ sub(Operand(ecx), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
621 __ cmp(ecx, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 621 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
622 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
622 __ j(below_equal, &shift_arguments); 623 __ j(below_equal, &shift_arguments);
623 624
624 __ bind(&convert_to_object); 625 __ bind(&convert_to_object);
625 __ EnterInternalFrame(); // In order to preserve argument count. 626 __ EnterInternalFrame(); // In order to preserve argument count.
626 __ SmiTag(eax); 627 __ SmiTag(eax);
627 __ push(eax); 628 __ push(eax);
628 629
629 __ push(ebx); 630 __ push(ebx);
630 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 631 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
631 __ mov(ebx, eax); 632 __ mov(ebx, eax);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 __ cmp(ebx, factory->null_value()); 774 __ cmp(ebx, factory->null_value());
774 __ j(equal, &use_global_receiver); 775 __ j(equal, &use_global_receiver);
775 __ cmp(ebx, factory->undefined_value()); 776 __ cmp(ebx, factory->undefined_value());
776 __ j(equal, &use_global_receiver); 777 __ j(equal, &use_global_receiver);
777 778
778 // If given receiver is already a JavaScript object then there's no 779 // If given receiver is already a JavaScript object then there's no
779 // reason for converting it. 780 // reason for converting it.
780 // We don't use IsObjectJSObjectType here because we jump on success. 781 // We don't use IsObjectJSObjectType here because we jump on success.
781 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); 782 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
782 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 783 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
783 __ sub(Operand(ecx), Immediate(FIRST_JS_OBJECT_TYPE)); 784 __ sub(Operand(ecx), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
784 __ cmp(ecx, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 785 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
786 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE);
785 __ j(below_equal, &push_receiver); 787 __ j(below_equal, &push_receiver);
786 788
787 // Convert the receiver to an object. 789 // Convert the receiver to an object.
788 __ bind(&call_to_object); 790 __ bind(&call_to_object);
789 __ push(ebx); 791 __ push(ebx);
790 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 792 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
791 __ mov(ebx, Operand(eax)); 793 __ mov(ebx, Operand(eax));
792 __ jmp(&push_receiver); 794 __ jmp(&push_receiver);
793 795
794 // Use the current global receiver object as the receiver. 796 // Use the current global receiver object as the receiver.
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1600 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1599 generator.Generate(); 1601 generator.Generate();
1600 } 1602 }
1601 1603
1602 1604
1603 #undef __ 1605 #undef __
1604 } 1606 }
1605 } // namespace v8::internal 1607 } // namespace v8::internal
1606 1608
1607 #endif // V8_TARGET_ARCH_IA32 1609 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698