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

Side by Side Diff: src/x64/codegen-x64.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/x64/codegen-x64.h ('k') | src/x64/full-codegen-x64.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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 561 }
562 } 562 }
563 563
564 ASSERT(has_valid_frame()); 564 ASSERT(has_valid_frame());
565 ASSERT(frame_->height() == original_height + 1); 565 ASSERT(frame_->height() == original_height + 1);
566 } 566 }
567 567
568 568
569 void CodeGenerator::LoadGlobal() { 569 void CodeGenerator::LoadGlobal() {
570 if (in_spilled_code()) { 570 if (in_spilled_code()) {
571 frame_->EmitPush(GlobalObject()); 571 frame_->EmitPush(GlobalObjectOperand());
572 } else { 572 } else {
573 Result temp = allocator_->Allocate(); 573 Result temp = allocator_->Allocate();
574 __ movq(temp.reg(), GlobalObject()); 574 __ movq(temp.reg(), GlobalObjectOperand());
575 frame_->Push(&temp); 575 frame_->Push(&temp);
576 } 576 }
577 } 577 }
578 578
579 579
580 void CodeGenerator::LoadGlobalReceiver() { 580 void CodeGenerator::LoadGlobalReceiver() {
581 Result temp = allocator_->Allocate(); 581 Result temp = allocator_->Allocate();
582 Register reg = temp.reg(); 582 Register reg = temp.reg();
583 __ movq(reg, GlobalObject()); 583 __ movq(reg, GlobalObjectOperand());
584 __ movq(reg, FieldOperand(reg, GlobalObject::kGlobalReceiverOffset)); 584 __ movq(reg, FieldOperand(reg, GlobalObject::kGlobalReceiverOffset));
585 frame_->Push(&temp); 585 frame_->Push(&temp);
586 } 586 }
587 587
588 588
589 void CodeGenerator::LoadTypeofExpression(Expression* expr) { 589 void CodeGenerator::LoadTypeofExpression(Expression* expr) {
590 // Special handling of identifiers as subexpressions of typeof. 590 // Special handling of identifiers as subexpressions of typeof.
591 Variable* variable = expr->AsVariableProxy()->AsVariable(); 591 Variable* variable = expr->AsVariableProxy()->AsVariable();
592 if (variable != NULL && !variable->is_this() && variable->is_global()) { 592 if (variable != NULL && !variable->is_this() && variable->is_global()) {
593 // For a global variable we build the property reference 593 // For a global variable we build the property reference
(...skipping 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after
5585 Reference ref(this, property, false); 5585 Reference ref(this, property, false);
5586 ref.GetValue(); 5586 ref.GetValue();
5587 // Use global object as receiver. 5587 // Use global object as receiver.
5588 LoadGlobalReceiver(); 5588 LoadGlobalReceiver();
5589 // Call the function. 5589 // Call the function.
5590 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position()); 5590 CallWithArguments(args, RECEIVER_MIGHT_BE_VALUE, node->position());
5591 } else { 5591 } else {
5592 // Push the receiver onto the frame. 5592 // Push the receiver onto the frame.
5593 Load(property->obj()); 5593 Load(property->obj());
5594 5594
5595 // Load the name of the function.
5596 Load(property->key());
5597
5598 // Swap the name of the function and the receiver on the stack to follow
5599 // the calling convention for call ICs.
5600 Result key = frame_->Pop();
5601 Result receiver = frame_->Pop();
5602 frame_->Push(&key);
5603 frame_->Push(&receiver);
5604 key.Unuse();
5605 receiver.Unuse();
5606
5595 // Load the arguments. 5607 // Load the arguments.
5596 int arg_count = args->length(); 5608 int arg_count = args->length();
5597 for (int i = 0; i < arg_count; i++) { 5609 for (int i = 0; i < arg_count; i++) {
5598 Load(args->at(i)); 5610 Load(args->at(i));
5599 frame_->SpillTop(); 5611 frame_->SpillTop();
5600 } 5612 }
5601 5613
5602 // Load the name of the function. 5614 // Place the key on top of stack and call the IC initialization code.
5603 Load(property->key()); 5615 frame_->PushElementAt(arg_count + 1);
5604
5605 // Call the IC initialization code.
5606 CodeForSourcePosition(node->position()); 5616 CodeForSourcePosition(node->position());
5607 Result result = frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET, 5617 Result result = frame_->CallKeyedCallIC(RelocInfo::CODE_TARGET,
5608 arg_count, 5618 arg_count,
5609 loop_nesting()); 5619 loop_nesting());
5620 frame_->Drop(); // Drop the key still on the stack.
5610 frame_->RestoreContextRegister(); 5621 frame_->RestoreContextRegister();
5611 frame_->Push(&result); 5622 frame_->Push(&result);
5612 } 5623 }
5613 } 5624 }
5614 } else { 5625 } else {
5615 // ---------------------------------- 5626 // ----------------------------------
5616 // JavaScript example: 'foo(1, 2, 3)' // foo is not global 5627 // JavaScript example: 'foo(1, 2, 3)' // foo is not global
5617 // ---------------------------------- 5628 // ----------------------------------
5618 5629
5619 // Load the function. 5630 // Load the function.
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
6055 // prototype is the un-modified String prototype. If not result is false. 6066 // prototype is the un-modified String prototype. If not result is false.
6056 __ movq(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset)); 6067 __ movq(scratch1_, FieldOperand(map_result_, Map::kPrototypeOffset));
6057 __ testq(scratch1_, Immediate(kSmiTagMask)); 6068 __ testq(scratch1_, Immediate(kSmiTagMask));
6058 __ j(zero, &false_result); 6069 __ j(zero, &false_result);
6059 __ movq(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset)); 6070 __ movq(scratch1_, FieldOperand(scratch1_, HeapObject::kMapOffset));
6060 __ movq(scratch2_, 6071 __ movq(scratch2_,
6061 Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 6072 Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
6062 __ movq(scratch2_, 6073 __ movq(scratch2_,
6063 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset)); 6074 FieldOperand(scratch2_, GlobalObject::kGlobalContextOffset));
6064 __ cmpq(scratch1_, 6075 __ cmpq(scratch1_,
6065 CodeGenerator::ContextOperand( 6076 ContextOperand(
6066 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 6077 scratch2_, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
6067 __ j(not_equal, &false_result); 6078 __ j(not_equal, &false_result);
6068 // Set the bit in the map to indicate that it has been checked safe for 6079 // Set the bit in the map to indicate that it has been checked safe for
6069 // default valueOf and set true result. 6080 // default valueOf and set true result.
6070 __ or_(FieldOperand(map_result_, Map::kBitField2Offset), 6081 __ or_(FieldOperand(map_result_, Map::kBitField2Offset),
6071 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); 6082 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
6072 __ Set(map_result_, 1); 6083 __ Set(map_result_, 1);
6073 __ jmp(exit_label()); 6084 __ jmp(exit_label());
6074 __ bind(&false_result); 6085 __ bind(&false_result);
6075 // Set false result. 6086 // Set false result.
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
7212 } 7223 }
7213 7224
7214 ZoneList<Expression*>* args = node->arguments(); 7225 ZoneList<Expression*>* args = node->arguments();
7215 Comment cmnt(masm_, "[ CallRuntime"); 7226 Comment cmnt(masm_, "[ CallRuntime");
7216 Runtime::Function* function = node->function(); 7227 Runtime::Function* function = node->function();
7217 7228
7218 if (function == NULL) { 7229 if (function == NULL) {
7219 // Push the builtins object found in the current global object. 7230 // Push the builtins object found in the current global object.
7220 Result temp = allocator()->Allocate(); 7231 Result temp = allocator()->Allocate();
7221 ASSERT(temp.is_valid()); 7232 ASSERT(temp.is_valid());
7222 __ movq(temp.reg(), GlobalObject()); 7233 __ movq(temp.reg(), GlobalObjectOperand());
7223 __ movq(temp.reg(), 7234 __ movq(temp.reg(),
7224 FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); 7235 FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset));
7225 frame_->Push(&temp); 7236 frame_->Push(&temp);
7226 } 7237 }
7227 7238
7228 // Push the arguments ("left-to-right"). 7239 // Push the arguments ("left-to-right").
7229 int arg_count = args->length(); 7240 int arg_count = args->length();
7230 for (int i = 0; i < arg_count; i++) { 7241 for (int i = 0; i < arg_count; i++) {
7231 Load(args->at(i)); 7242 Load(args->at(i));
7232 } 7243 }
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
8856 #undef __ 8867 #undef __
8857 8868
8858 void RecordWriteStub::Generate(MacroAssembler* masm) { 8869 void RecordWriteStub::Generate(MacroAssembler* masm) {
8859 masm->RecordWriteHelper(object_, addr_, scratch_); 8870 masm->RecordWriteHelper(object_, addr_, scratch_);
8860 masm->ret(0); 8871 masm->ret(0);
8861 } 8872 }
8862 8873
8863 } } // namespace v8::internal 8874 } } // namespace v8::internal
8864 8875
8865 #endif // V8_TARGET_ARCH_X64 8876 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698