OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 679 } |
680 } | 680 } |
681 } | 681 } |
682 ASSERT(has_valid_frame()); | 682 ASSERT(has_valid_frame()); |
683 ASSERT(frame_->height() == original_height + 1); | 683 ASSERT(frame_->height() == original_height + 1); |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 void CodeGenerator::LoadGlobal() { | 687 void CodeGenerator::LoadGlobal() { |
688 if (in_spilled_code()) { | 688 if (in_spilled_code()) { |
689 frame_->EmitPush(GlobalObject()); | 689 frame_->EmitPush(GlobalObjectOperand()); |
690 } else { | 690 } else { |
691 Result temp = allocator_->Allocate(); | 691 Result temp = allocator_->Allocate(); |
692 __ mov(temp.reg(), GlobalObject()); | 692 __ mov(temp.reg(), GlobalObjectOperand()); |
693 frame_->Push(&temp); | 693 frame_->Push(&temp); |
694 } | 694 } |
695 } | 695 } |
696 | 696 |
697 | 697 |
698 void CodeGenerator::LoadGlobalReceiver() { | 698 void CodeGenerator::LoadGlobalReceiver() { |
699 Result temp = allocator_->Allocate(); | 699 Result temp = allocator_->Allocate(); |
700 Register reg = temp.reg(); | 700 Register reg = temp.reg(); |
701 __ mov(reg, GlobalObject()); | 701 __ mov(reg, GlobalObjectOperand()); |
702 __ mov(reg, FieldOperand(reg, GlobalObject::kGlobalReceiverOffset)); | 702 __ mov(reg, FieldOperand(reg, GlobalObject::kGlobalReceiverOffset)); |
703 frame_->Push(&temp); | 703 frame_->Push(&temp); |
704 } | 704 } |
705 | 705 |
706 | 706 |
707 void CodeGenerator::LoadTypeofExpression(Expression* expr) { | 707 void CodeGenerator::LoadTypeofExpression(Expression* expr) { |
708 // Special handling of identifiers as subexpressions of typeof. | 708 // Special handling of identifiers as subexpressions of typeof. |
709 Variable* variable = expr->AsVariableProxy()->AsVariable(); | 709 Variable* variable = expr->AsVariableProxy()->AsVariable(); |
710 if (variable != NULL && !variable->is_this() && variable->is_global()) { | 710 if (variable != NULL && !variable->is_this() && variable->is_global()) { |
711 // For a global variable we build the property reference | 711 // For a global variable we build the property reference |
(...skipping 6059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6771 // If a valueOf property is not found on the object check that it's | 6771 // If a valueOf property is not found on the object check that it's |
6772 // prototype is the un-modified String prototype. If not result is false. | 6772 // prototype is the un-modified String prototype. If not result is false. |
6773 __ mov(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset)); | 6773 __ mov(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset)); |
6774 __ test(scratch1_, Immediate(kSmiTagMask)); | 6774 __ test(scratch1_, Immediate(kSmiTagMask)); |
6775 __ j(zero, &false_result); | 6775 __ j(zero, &false_result); |
6776 __ mov(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset)); | 6776 __ mov(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset)); |
6777 __ mov(scratch2_, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 6777 __ mov(scratch2_, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
6778 __ mov(scratch2_, | 6778 __ mov(scratch2_, |
6779 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset)); | 6779 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset)); |
6780 __ cmp(scratch1_, | 6780 __ cmp(scratch1_, |
6781 CodeGenerator::ContextOperand( | 6781 ContextOperand(scratch2_, |
6782 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 6782 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
6783 __ j(not_equal, &false_result); | 6783 __ j(not_equal, &false_result); |
6784 // Set the bit in the map to indicate that it has been checked safe for | 6784 // Set the bit in the map to indicate that it has been checked safe for |
6785 // default valueOf and set true result. | 6785 // default valueOf and set true result. |
6786 __ or_(FieldOperand(map_result_, Map::kBitField2Offset), | 6786 __ or_(FieldOperand(map_result_, Map::kBitField2Offset), |
6787 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 6787 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
6788 __ Set(map_result_, Immediate(1)); | 6788 __ Set(map_result_, Immediate(1)); |
6789 __ jmp(exit_label()); | 6789 __ jmp(exit_label()); |
6790 __ bind(&false_result); | 6790 __ bind(&false_result); |
6791 // Set false result. | 6791 // Set false result. |
6792 __ Set(map_result_, Immediate(0)); | 6792 __ Set(map_result_, Immediate(0)); |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7927 } | 7927 } |
7928 | 7928 |
7929 ZoneList<Expression*>* args = node->arguments(); | 7929 ZoneList<Expression*>* args = node->arguments(); |
7930 Comment cmnt(masm_, "[ CallRuntime"); | 7930 Comment cmnt(masm_, "[ CallRuntime"); |
7931 Runtime::Function* function = node->function(); | 7931 Runtime::Function* function = node->function(); |
7932 | 7932 |
7933 if (function == NULL) { | 7933 if (function == NULL) { |
7934 // Push the builtins object found in the current global object. | 7934 // Push the builtins object found in the current global object. |
7935 Result temp = allocator()->Allocate(); | 7935 Result temp = allocator()->Allocate(); |
7936 ASSERT(temp.is_valid()); | 7936 ASSERT(temp.is_valid()); |
7937 __ mov(temp.reg(), GlobalObject()); | 7937 __ mov(temp.reg(), GlobalObjectOperand()); |
7938 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); | 7938 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); |
7939 frame_->Push(&temp); | 7939 frame_->Push(&temp); |
7940 } | 7940 } |
7941 | 7941 |
7942 // Push the arguments ("left-to-right"). | 7942 // Push the arguments ("left-to-right"). |
7943 int arg_count = args->length(); | 7943 int arg_count = args->length(); |
7944 for (int i = 0; i < arg_count; i++) { | 7944 for (int i = 0; i < arg_count; i++) { |
7945 Load(args->at(i)); | 7945 Load(args->at(i)); |
7946 } | 7946 } |
7947 | 7947 |
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10071 masm.GetCode(&desc); | 10071 masm.GetCode(&desc); |
10072 // Call the function from C++. | 10072 // Call the function from C++. |
10073 return FUNCTION_CAST<MemCopyFunction>(buffer); | 10073 return FUNCTION_CAST<MemCopyFunction>(buffer); |
10074 } | 10074 } |
10075 | 10075 |
10076 #undef __ | 10076 #undef __ |
10077 | 10077 |
10078 } } // namespace v8::internal | 10078 } } // namespace v8::internal |
10079 | 10079 |
10080 #endif // V8_TARGET_ARCH_IA32 | 10080 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |