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

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: 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_OBJECT_OR_FUNCTION_CLASS_TYPE, it is not an object in the ECMA sense.
363 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); 363 __ CmpObjectType(eax, FIRST_OBJECT_OR_FUNCTION_CLASS_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_OBJECT_CLASS_TYPE));
621 __ cmp(ecx, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 621 __ cmp(ecx, LAST_OBJECT_CLASS_TYPE - FIRST_OBJECT_CLASS_TYPE);
622 __ j(below_equal, &shift_arguments); 622 __ j(below_equal, &shift_arguments);
623 623
624 __ bind(&convert_to_object); 624 __ bind(&convert_to_object);
625 __ EnterInternalFrame(); // In order to preserve argument count. 625 __ EnterInternalFrame(); // In order to preserve argument count.
626 __ SmiTag(eax); 626 __ SmiTag(eax);
627 __ push(eax); 627 __ push(eax);
628 628
629 __ push(ebx); 629 __ push(ebx);
630 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 630 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
631 __ mov(ebx, eax); 631 __ mov(ebx, eax);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 __ cmp(ebx, factory->null_value()); 773 __ cmp(ebx, factory->null_value());
774 __ j(equal, &use_global_receiver); 774 __ j(equal, &use_global_receiver);
775 __ cmp(ebx, factory->undefined_value()); 775 __ cmp(ebx, factory->undefined_value());
776 __ j(equal, &use_global_receiver); 776 __ j(equal, &use_global_receiver);
777 777
778 // If given receiver is already a JavaScript object then there's no 778 // If given receiver is already a JavaScript object then there's no
779 // reason for converting it. 779 // reason for converting it.
780 // We don't use IsObjectJSObjectType here because we jump on success. 780 // We don't use IsObjectJSObjectType here because we jump on success.
781 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); 781 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset));
782 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 782 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
783 __ sub(Operand(ecx), Immediate(FIRST_JS_OBJECT_TYPE)); 783 __ sub(Operand(ecx), Immediate(FIRST_OBJECT_CLASS_TYPE));
784 __ cmp(ecx, LAST_JS_OBJECT_TYPE - FIRST_JS_OBJECT_TYPE); 784 __ cmp(ecx, LAST_OBJECT_CLASS_TYPE - FIRST_OBJECT_CLASS_TYPE);
785 __ j(below_equal, &push_receiver); 785 __ j(below_equal, &push_receiver);
786 786
787 // Convert the receiver to an object. 787 // Convert the receiver to an object.
788 __ bind(&call_to_object); 788 __ bind(&call_to_object);
789 __ push(ebx); 789 __ push(ebx);
790 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 790 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
791 __ mov(ebx, Operand(eax)); 791 __ mov(ebx, Operand(eax));
792 __ jmp(&push_receiver); 792 __ jmp(&push_receiver);
793 793
794 // Use the current global receiver object as the receiver. 794 // 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); 1598 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1599 generator.Generate(); 1599 generator.Generate();
1600 } 1600 }
1601 1601
1602 1602
1603 #undef __ 1603 #undef __
1604 } 1604 }
1605 } // namespace v8::internal 1605 } // namespace v8::internal
1606 1606
1607 #endif // V8_TARGET_ARCH_IA32 1607 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698