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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.h » ('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 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } else if (prop != NULL) { 739 } else if (prop != NULL) {
740 // A const declaration aliasing a parameter is an illegal redeclaration. 740 // A const declaration aliasing a parameter is an illegal redeclaration.
741 ASSERT(mode != Variable::CONST); 741 ASSERT(mode != Variable::CONST);
742 if (function != NULL) { 742 if (function != NULL) {
743 // We are declaring a function that rewrites to a property. 743 // We are declaring a function that rewrites to a property.
744 // Use (keyed) IC to set the initial value. We cannot visit the 744 // Use (keyed) IC to set the initial value. We cannot visit the
745 // rewrite because it's shared and we risk recording duplicate AST 745 // rewrite because it's shared and we risk recording duplicate AST
746 // IDs for bailouts from optimized code. 746 // IDs for bailouts from optimized code.
747 ASSERT(prop->obj()->AsVariableProxy() != NULL); 747 ASSERT(prop->obj()->AsVariableProxy() != NULL);
748 { AccumulatorValueContext for_object(this); 748 { AccumulatorValueContext for_object(this);
749 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); 749 EmitVariableLoad(prop->obj()->AsVariableProxy());
750 } 750 }
751 __ push(rax); 751 __ push(rax);
752 VisitForAccumulatorValue(function); 752 VisitForAccumulatorValue(function);
753 __ pop(rdx); 753 __ pop(rdx);
754 ASSERT(prop->key()->AsLiteral() != NULL && 754 ASSERT(prop->key()->AsLiteral() != NULL &&
755 prop->key()->AsLiteral()->handle()->IsSmi()); 755 prop->key()->AsLiteral()->handle()->IsSmi());
756 __ Move(rcx, prop->key()->AsLiteral()->handle()); 756 __ Move(rcx, prop->key()->AsLiteral()->handle());
757 757
758 Handle<Code> ic = is_strict_mode() 758 Handle<Code> ic = is_strict_mode()
759 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 759 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 ? isolate()->factory()->true_value() 1069 ? isolate()->factory()->true_value()
1070 : isolate()->factory()->false_value()); 1070 : isolate()->factory()->false_value());
1071 __ CallRuntime(Runtime::kNewClosure, 3); 1071 __ CallRuntime(Runtime::kNewClosure, 3);
1072 } 1072 }
1073 context()->Plug(rax); 1073 context()->Plug(rax);
1074 } 1074 }
1075 1075
1076 1076
1077 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 1077 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
1078 Comment cmnt(masm_, "[ VariableProxy"); 1078 Comment cmnt(masm_, "[ VariableProxy");
1079 EmitVariableLoad(expr->var()); 1079 EmitVariableLoad(expr);
1080 } 1080 }
1081 1081
1082 1082
1083 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( 1083 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
1084 Slot* slot, 1084 Slot* slot,
1085 TypeofState typeof_state, 1085 TypeofState typeof_state,
1086 Label* slow) { 1086 Label* slow) {
1087 Register context = rsi; 1087 Register context = rsi;
1088 Register temp = rdx; 1088 Register temp = rdx;
1089 1089
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 isolate()->builtins()->KeyedLoadIC_Initialize(); 1220 isolate()->builtins()->KeyedLoadIC_Initialize();
1221 __ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); 1221 __ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
1222 __ jmp(done); 1222 __ jmp(done);
1223 } 1223 }
1224 } 1224 }
1225 } 1225 }
1226 } 1226 }
1227 } 1227 }
1228 1228
1229 1229
1230 void FullCodeGenerator::EmitVariableLoad(Variable* var) { 1230 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
1231 // Record position before possible IC call.
1232 SetSourcePosition(proxy->position());
1233 Variable* var = proxy->var();
1234
1231 // Three cases: non-this global variables, lookup slots, and all other 1235 // Three cases: non-this global variables, lookup slots, and all other
1232 // types of slots. 1236 // types of slots.
1233 Slot* slot = var->AsSlot(); 1237 Slot* slot = var->AsSlot();
1234 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); 1238 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL));
1235 1239
1236 if (slot == NULL) { 1240 if (slot == NULL) {
1237 Comment cmnt(masm_, "Global variable"); 1241 Comment cmnt(masm_, "Global variable");
1238 // Use inline caching. Variable name is passed in rcx and the global 1242 // Use inline caching. Variable name is passed in rcx and the global
1239 // object on the stack. 1243 // object on the stack.
1240 __ Move(rcx, var->name()); 1244 __ Move(rcx, var->name());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 break; 1550 break;
1547 } 1551 }
1548 } 1552 }
1549 1553
1550 // For compound assignments we need another deoptimization point after the 1554 // For compound assignments we need another deoptimization point after the
1551 // variable/property load. 1555 // variable/property load.
1552 if (expr->is_compound()) { 1556 if (expr->is_compound()) {
1553 { AccumulatorValueContext context(this); 1557 { AccumulatorValueContext context(this);
1554 switch (assign_type) { 1558 switch (assign_type) {
1555 case VARIABLE: 1559 case VARIABLE:
1556 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); 1560 EmitVariableLoad(expr->target()->AsVariableProxy());
1557 PrepareForBailout(expr->target(), TOS_REG); 1561 PrepareForBailout(expr->target(), TOS_REG);
1558 break; 1562 break;
1559 case NAMED_PROPERTY: 1563 case NAMED_PROPERTY:
1560 EmitNamedPropertyLoad(property); 1564 EmitNamedPropertyLoad(property);
1561 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1565 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1562 break; 1566 break;
1563 case KEYED_PROPERTY: 1567 case KEYED_PROPERTY:
1564 EmitKeyedPropertyLoad(property); 1568 EmitKeyedPropertyLoad(property);
1565 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1569 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1566 break; 1570 break;
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 2667
2664 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) { 2668 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) {
2665 // Conditionally generate a log call. 2669 // Conditionally generate a log call.
2666 // Args: 2670 // Args:
2667 // 0 (literal string): The type of logging (corresponds to the flags). 2671 // 0 (literal string): The type of logging (corresponds to the flags).
2668 // This is used to determine whether or not to generate the log call. 2672 // This is used to determine whether or not to generate the log call.
2669 // 1 (string): Format string. Access the string at argument index 2 2673 // 1 (string): Format string. Access the string at argument index 2
2670 // with '%2s' (see Logger::LogRuntime for all the formats). 2674 // with '%2s' (see Logger::LogRuntime for all the formats).
2671 // 2 (array): Arguments to the format string. 2675 // 2 (array): Arguments to the format string.
2672 ASSERT_EQ(args->length(), 3); 2676 ASSERT_EQ(args->length(), 3);
2673 #ifdef ENABLE_LOGGING_AND_PROFILING
2674 if (CodeGenerator::ShouldGenerateLog(args->at(0))) { 2677 if (CodeGenerator::ShouldGenerateLog(args->at(0))) {
2675 VisitForStackValue(args->at(1)); 2678 VisitForStackValue(args->at(1));
2676 VisitForStackValue(args->at(2)); 2679 VisitForStackValue(args->at(2));
2677 __ CallRuntime(Runtime::kLog, 2); 2680 __ CallRuntime(Runtime::kLog, 2);
2678 } 2681 }
2679 #endif
2680 // Finally, we're expected to leave a value on the top of the stack. 2682 // Finally, we're expected to leave a value on the top of the stack.
2681 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 2683 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
2682 context()->Plug(rax); 2684 context()->Plug(rax);
2683 } 2685 }
2684 2686
2685 2687
2686 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) { 2688 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
2687 ASSERT(args->length() == 0); 2689 ASSERT(args->length() == 0);
2688 2690
2689 Label slow_allocate_heapnumber; 2691 Label slow_allocate_heapnumber;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
3758 // of the key to detect a named property. 3760 // of the key to detect a named property.
3759 if (prop != NULL) { 3761 if (prop != NULL) {
3760 assign_type = 3762 assign_type =
3761 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; 3763 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
3762 } 3764 }
3763 3765
3764 // Evaluate expression and get value. 3766 // Evaluate expression and get value.
3765 if (assign_type == VARIABLE) { 3767 if (assign_type == VARIABLE) {
3766 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); 3768 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL);
3767 AccumulatorValueContext context(this); 3769 AccumulatorValueContext context(this);
3768 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); 3770 EmitVariableLoad(expr->expression()->AsVariableProxy());
3769 } else { 3771 } else {
3770 // Reserve space for result of postfix operation. 3772 // Reserve space for result of postfix operation.
3771 if (expr->is_postfix() && !context()->IsEffect()) { 3773 if (expr->is_postfix() && !context()->IsEffect()) {
3772 __ Push(Smi::FromInt(0)); 3774 __ Push(Smi::FromInt(0));
3773 } 3775 }
3774 if (assign_type == NAMED_PROPERTY) { 3776 if (assign_type == NAMED_PROPERTY) {
3775 VisitForAccumulatorValue(prop->obj()); 3777 VisitForAccumulatorValue(prop->obj());
3776 __ push(rax); // Copy of receiver, needed for later store. 3778 __ push(rax); // Copy of receiver, needed for later store.
3777 EmitNamedPropertyLoad(prop); 3779 EmitNamedPropertyLoad(prop);
3778 } else { 3780 } else {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 4072 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
4071 __ testq(rax, rax); 4073 __ testq(rax, rax);
4072 // The stub returns 0 for true. 4074 // The stub returns 0 for true.
4073 Split(zero, if_true, if_false, fall_through); 4075 Split(zero, if_true, if_false, fall_through);
4074 break; 4076 break;
4075 } 4077 }
4076 4078
4077 default: { 4079 default: {
4078 VisitForAccumulatorValue(expr->right()); 4080 VisitForAccumulatorValue(expr->right());
4079 Condition cc = no_condition; 4081 Condition cc = no_condition;
4080 bool strict = false;
4081 switch (op) { 4082 switch (op) {
4082 case Token::EQ_STRICT: 4083 case Token::EQ_STRICT:
4083 strict = true;
4084 // Fall through. 4084 // Fall through.
4085 case Token::EQ: 4085 case Token::EQ:
4086 cc = equal; 4086 cc = equal;
4087 __ pop(rdx); 4087 __ pop(rdx);
4088 break; 4088 break;
4089 case Token::LT: 4089 case Token::LT:
4090 cc = less; 4090 cc = less;
4091 __ pop(rdx); 4091 __ pop(rdx);
4092 break; 4092 break;
4093 case Token::GT: 4093 case Token::GT:
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4248 __ jmp(rdx); 4248 __ jmp(rdx);
4249 } 4249 }
4250 4250
4251 4251
4252 #undef __ 4252 #undef __
4253 4253
4254 4254
4255 } } // namespace v8::internal 4255 } } // namespace v8::internal
4256 4256
4257 #endif // V8_TARGET_ARCH_X64 4257 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698