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

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

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month 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/codegen-ia32.h ('k') | src/ia32/full-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 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 masm_(masm), 147 masm_(masm),
148 info_(NULL), 148 info_(NULL),
149 frame_(NULL), 149 frame_(NULL),
150 allocator_(NULL), 150 allocator_(NULL),
151 state_(NULL), 151 state_(NULL),
152 loop_nesting_(0), 152 loop_nesting_(0),
153 in_safe_int32_mode_(false), 153 in_safe_int32_mode_(false),
154 safe_int32_mode_enabled_(true), 154 safe_int32_mode_enabled_(true),
155 function_return_is_shadowed_(false), 155 function_return_is_shadowed_(false),
156 in_spilled_code_(false), 156 in_spilled_code_(false),
157 jit_cookie_((FLAG_mask_constants_with_cookie) ? V8::Random() : 0) { 157 jit_cookie_((FLAG_mask_constants_with_cookie) ? V8::RandomPrivate() : 0) {
158 } 158 }
159 159
160 160
161 // Calling conventions: 161 // Calling conventions:
162 // ebp: caller's frame pointer 162 // ebp: caller's frame pointer
163 // esp: stack pointer 163 // esp: stack pointer
164 // edi: called JS function 164 // edi: called JS function
165 // esi: callee's context 165 // esi: callee's context
166 166
167 void CodeGenerator::Generate(CompilationInfo* info) { 167 void CodeGenerator::Generate(CompilationInfo* info) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 5575 matching lines...) Expand 10 before | Expand all | Expand 10 after
6287 Reference ref(this, property); 6287 Reference ref(this, property);
6288 ref.GetValue(); 6288 ref.GetValue();
6289 // Use global object as receiver. 6289 // Use global object as receiver.
6290 LoadGlobalReceiver(); 6290 LoadGlobalReceiver();
6291 // Call the function. 6291 // Call the function.
6292 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); 6292 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position());
6293 } else { 6293 } else {
6294 // Push the receiver onto the frame. 6294 // Push the receiver onto the frame.
6295 Load(property->obj()); 6295 Load(property->obj());
6296 6296
6297 // Load the name of the function.
6298 Load(property->key());
6299
6300 // Swap the name of the function and the receiver on the stack to follow
6301 // the calling convention for call ICs.
6302 Result key = frame_->Pop();
6303 Result receiver = frame_->Pop();
6304 frame_->Push(&key);
6305 frame_->Push(&receiver);
6306 key.Unuse();
6307 receiver.Unuse();
6308
6297 // Load the arguments. 6309 // Load the arguments.
6298 int arg_count = args->length(); 6310 int arg_count = args->length();
6299 for (int i = 0; i < arg_count; i++) { 6311 for (int i = 0; i < arg_count; i++) {
6300 Load(args->at(i)); 6312 Load(args->at(i));
6301 frame_->SpillTop(); 6313 frame_->SpillTop();
6302 } 6314 }
6303 6315
6304 // Load the name of the function. 6316 // Place the key on top of stack and call the IC initialization code.
6305 Load(property->key()); 6317 frame_->PushElementAt(arg_count + 1);
6306
6307 // Call the IC initialization code.
6308 CodeForSourcePosition(node->position()); 6318 CodeForSourcePosition(node->position());
6309 Result result = 6319 Result result =
6310 frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET, 6320 frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET,
6311 arg_count, 6321 arg_count,
6312 loop_nesting()); 6322 loop_nesting());
6323 frame_->Drop(); // Drop the key still on the stack.
6313 frame_->RestoreContextRegister(); 6324 frame_->RestoreContextRegister();
6314 frame_->Push(&result); 6325 frame_->Push(&result);
6315 } 6326 }
6316 } 6327 }
6317 6328
6318 } else { 6329 } else {
6319 // ---------------------------------- 6330 // ----------------------------------
6320 // JavaScript example: 'foo(1, 2, 3)' // foo is not global 6331 // JavaScript example: 'foo(1, 2, 3)' // foo is not global
6321 // ---------------------------------- 6332 // ----------------------------------
6322 6333
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
6771 // If a valueOf property is not found on the object check that it's 6782 // 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. 6783 // prototype is the un-modified String prototype. If not result is false.
6773 __ mov(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset)); 6784 __ mov(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset));
6774 __ test(scratch1_, Immediate(kSmiTagMask)); 6785 __ test(scratch1_, Immediate(kSmiTagMask));
6775 __ j(zero, &false_result); 6786 __ j(zero, &false_result);
6776 __ mov(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset)); 6787 __ mov(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset));
6777 __ mov(scratch2_, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 6788 __ mov(scratch2_, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
6778 __ mov(scratch2_, 6789 __ mov(scratch2_,
6779 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset)); 6790 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset));
6780 __ cmp(scratch1_, 6791 __ cmp(scratch1_,
6781 CodeGenerator::ContextOperand( 6792 ContextOperand(scratch2_,
6782 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 6793 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
6783 __ j(not_equal, &false_result); 6794 __ j(not_equal, &false_result);
6784 // Set the bit in the map to indicate that it has been checked safe for 6795 // Set the bit in the map to indicate that it has been checked safe for
6785 // default valueOf and set true result. 6796 // default valueOf and set true result.
6786 __ or_(FieldOperand(map_result_, Map::kBitField2Offset), 6797 __ or_(FieldOperand(map_result_, Map::kBitField2Offset),
6787 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); 6798 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
6788 __ Set(map_result_, Immediate(1)); 6799 __ Set(map_result_, Immediate(1));
6789 __ jmp(exit_label()); 6800 __ jmp(exit_label());
6790 __ bind(&false_result); 6801 __ bind(&false_result);
6791 // Set false result. 6802 // Set false result.
6792 __ Set(map_result_, Immediate(0)); 6803 __ Set(map_result_, Immediate(0));
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
7927 } 7938 }
7928 7939
7929 ZoneList<Expression*>* args = node->arguments(); 7940 ZoneList<Expression*>* args = node->arguments();
7930 Comment cmnt(masm_, "[ CallRuntime"); 7941 Comment cmnt(masm_, "[ CallRuntime");
7931 Runtime::Function* function = node->function(); 7942 Runtime::Function* function = node->function();
7932 7943
7933 if (function == NULL) { 7944 if (function == NULL) {
7934 // Push the builtins object found in the current global object. 7945 // Push the builtins object found in the current global object.
7935 Result temp = allocator()->Allocate(); 7946 Result temp = allocator()->Allocate();
7936 ASSERT(temp.is_valid()); 7947 ASSERT(temp.is_valid());
7937 __ mov(temp.reg(), GlobalObject()); 7948 __ mov(temp.reg(), GlobalObjectOperand());
7938 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); 7949 __ mov(temp.reg(), FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset));
7939 frame_->Push(&temp); 7950 frame_->Push(&temp);
7940 } 7951 }
7941 7952
7942 // Push the arguments ("left-to-right"). 7953 // Push the arguments ("left-to-right").
7943 int arg_count = args->length(); 7954 int arg_count = args->length();
7944 for (int i = 0; i < arg_count; i++) { 7955 for (int i = 0; i < arg_count; i++) {
7945 Load(args->at(i)); 7956 Load(args->at(i));
7946 } 7957 }
7947 7958
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
10071 masm.GetCode(&desc); 10082 masm.GetCode(&desc);
10072 // Call the function from C++. 10083 // Call the function from C++.
10073 return FUNCTION_CAST<MemCopyFunction>(buffer); 10084 return FUNCTION_CAST<MemCopyFunction>(buffer);
10074 } 10085 }
10075 10086
10076 #undef __ 10087 #undef __
10077 10088
10078 } } // namespace v8::internal 10089 } } // namespace v8::internal
10079 10090
10080 #endif // V8_TARGET_ARCH_IA32 10091 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698