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

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

Issue 7353017: 2011-07-13: Version 3.4.12 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 5 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/ia32/codegen-ia32.h ('k') | src/ia32/lithium-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 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } else if (prop != NULL) { 737 } else if (prop != NULL) {
738 // A const declaration aliasing a parameter is an illegal redeclaration. 738 // A const declaration aliasing a parameter is an illegal redeclaration.
739 ASSERT(mode != Variable::CONST); 739 ASSERT(mode != Variable::CONST);
740 if (function != NULL) { 740 if (function != NULL) {
741 // We are declaring a function that rewrites to a property. 741 // We are declaring a function that rewrites to a property.
742 // Use (keyed) IC to set the initial value. We cannot visit the 742 // Use (keyed) IC to set the initial value. We cannot visit the
743 // rewrite because it's shared and we risk recording duplicate AST 743 // rewrite because it's shared and we risk recording duplicate AST
744 // IDs for bailouts from optimized code. 744 // IDs for bailouts from optimized code.
745 ASSERT(prop->obj()->AsVariableProxy() != NULL); 745 ASSERT(prop->obj()->AsVariableProxy() != NULL);
746 { AccumulatorValueContext for_object(this); 746 { AccumulatorValueContext for_object(this);
747 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); 747 EmitVariableLoad(prop->obj()->AsVariableProxy());
748 } 748 }
749 749
750 __ push(eax); 750 __ push(eax);
751 VisitForAccumulatorValue(function); 751 VisitForAccumulatorValue(function);
752 __ pop(edx); 752 __ pop(edx);
753 753
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 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); 756 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle()));
757 757
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 ? isolate()->factory()->true_value() 1057 ? isolate()->factory()->true_value()
1058 : isolate()->factory()->false_value())); 1058 : isolate()->factory()->false_value()));
1059 __ CallRuntime(Runtime::kNewClosure, 3); 1059 __ CallRuntime(Runtime::kNewClosure, 3);
1060 } 1060 }
1061 context()->Plug(eax); 1061 context()->Plug(eax);
1062 } 1062 }
1063 1063
1064 1064
1065 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 1065 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
1066 Comment cmnt(masm_, "[ VariableProxy"); 1066 Comment cmnt(masm_, "[ VariableProxy");
1067 EmitVariableLoad(expr->var()); 1067 EmitVariableLoad(expr);
1068 } 1068 }
1069 1069
1070 1070
1071 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( 1071 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
1072 Slot* slot, 1072 Slot* slot,
1073 TypeofState typeof_state, 1073 TypeofState typeof_state,
1074 Label* slow) { 1074 Label* slow) {
1075 Register context = esi; 1075 Register context = esi;
1076 Register temp = edx; 1076 Register temp = edx;
1077 1077
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 isolate()->builtins()->KeyedLoadIC_Initialize(); 1207 isolate()->builtins()->KeyedLoadIC_Initialize();
1208 __ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); 1208 __ call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
1209 __ jmp(done); 1209 __ jmp(done);
1210 } 1210 }
1211 } 1211 }
1212 } 1212 }
1213 } 1213 }
1214 } 1214 }
1215 1215
1216 1216
1217 void FullCodeGenerator::EmitVariableLoad(Variable* var) { 1217 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
1218 // Record position before possible IC call.
1219 SetSourcePosition(proxy->position());
1220 Variable* var = proxy->var();
1221
1218 // Three cases: non-this global variables, lookup slots, and all other 1222 // Three cases: non-this global variables, lookup slots, and all other
1219 // types of slots. 1223 // types of slots.
1220 Slot* slot = var->AsSlot(); 1224 Slot* slot = var->AsSlot();
1221 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); 1225 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL));
1222 1226
1223 if (slot == NULL) { 1227 if (slot == NULL) {
1224 Comment cmnt(masm_, "Global variable"); 1228 Comment cmnt(masm_, "Global variable");
1225 // Use inline caching. Variable name is passed in ecx and the global 1229 // Use inline caching. Variable name is passed in ecx and the global
1226 // object on the stack. 1230 // object on the stack.
1227 __ mov(eax, GlobalObjectOperand()); 1231 __ mov(eax, GlobalObjectOperand());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 break; 1537 break;
1534 } 1538 }
1535 } 1539 }
1536 1540
1537 // For compound assignments we need another deoptimization point after the 1541 // For compound assignments we need another deoptimization point after the
1538 // variable/property load. 1542 // variable/property load.
1539 if (expr->is_compound()) { 1543 if (expr->is_compound()) {
1540 { AccumulatorValueContext context(this); 1544 { AccumulatorValueContext context(this);
1541 switch (assign_type) { 1545 switch (assign_type) {
1542 case VARIABLE: 1546 case VARIABLE:
1543 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); 1547 EmitVariableLoad(expr->target()->AsVariableProxy());
1544 PrepareForBailout(expr->target(), TOS_REG); 1548 PrepareForBailout(expr->target(), TOS_REG);
1545 break; 1549 break;
1546 case NAMED_PROPERTY: 1550 case NAMED_PROPERTY:
1547 EmitNamedPropertyLoad(property); 1551 EmitNamedPropertyLoad(property);
1548 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1552 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1549 break; 1553 break;
1550 case KEYED_PROPERTY: 1554 case KEYED_PROPERTY:
1551 EmitKeyedPropertyLoad(property); 1555 EmitKeyedPropertyLoad(property);
1552 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1556 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1553 break; 1557 break;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 : isolate()->builtins()->StoreIC_Initialize(); 1766 : isolate()->builtins()->StoreIC_Initialize();
1763 __ call(ic); 1767 __ call(ic);
1764 break; 1768 break;
1765 } 1769 }
1766 case KEYED_PROPERTY: { 1770 case KEYED_PROPERTY: {
1767 __ push(eax); // Preserve value. 1771 __ push(eax); // Preserve value.
1768 if (prop->is_synthetic()) { 1772 if (prop->is_synthetic()) {
1769 ASSERT(prop->obj()->AsVariableProxy() != NULL); 1773 ASSERT(prop->obj()->AsVariableProxy() != NULL);
1770 ASSERT(prop->key()->AsLiteral() != NULL); 1774 ASSERT(prop->key()->AsLiteral() != NULL);
1771 { AccumulatorValueContext for_object(this); 1775 { AccumulatorValueContext for_object(this);
1772 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); 1776 EmitVariableLoad(prop->obj()->AsVariableProxy());
1773 } 1777 }
1774 __ mov(edx, eax); 1778 __ mov(edx, eax);
1775 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); 1779 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle()));
1776 } else { 1780 } else {
1777 VisitForStackValue(prop->obj()); 1781 VisitForStackValue(prop->obj());
1778 VisitForAccumulatorValue(prop->key()); 1782 VisitForAccumulatorValue(prop->key());
1779 __ mov(ecx, eax); 1783 __ mov(ecx, eax);
1780 __ pop(edx); 1784 __ pop(edx);
1781 } 1785 }
1782 __ pop(eax); // Restore value. 1786 __ pop(eax); // Restore value.
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 2698
2695 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) { 2699 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) {
2696 // Conditionally generate a log call. 2700 // Conditionally generate a log call.
2697 // Args: 2701 // Args:
2698 // 0 (literal string): The type of logging (corresponds to the flags). 2702 // 0 (literal string): The type of logging (corresponds to the flags).
2699 // This is used to determine whether or not to generate the log call. 2703 // This is used to determine whether or not to generate the log call.
2700 // 1 (string): Format string. Access the string at argument index 2 2704 // 1 (string): Format string. Access the string at argument index 2
2701 // with '%2s' (see Logger::LogRuntime for all the formats). 2705 // with '%2s' (see Logger::LogRuntime for all the formats).
2702 // 2 (array): Arguments to the format string. 2706 // 2 (array): Arguments to the format string.
2703 ASSERT_EQ(args->length(), 3); 2707 ASSERT_EQ(args->length(), 3);
2704 #ifdef ENABLE_LOGGING_AND_PROFILING
2705 if (CodeGenerator::ShouldGenerateLog(args->at(0))) { 2708 if (CodeGenerator::ShouldGenerateLog(args->at(0))) {
2706 VisitForStackValue(args->at(1)); 2709 VisitForStackValue(args->at(1));
2707 VisitForStackValue(args->at(2)); 2710 VisitForStackValue(args->at(2));
2708 __ CallRuntime(Runtime::kLog, 2); 2711 __ CallRuntime(Runtime::kLog, 2);
2709 } 2712 }
2710 #endif
2711 // Finally, we're expected to leave a value on the top of the stack. 2713 // Finally, we're expected to leave a value on the top of the stack.
2712 __ mov(eax, isolate()->factory()->undefined_value()); 2714 __ mov(eax, isolate()->factory()->undefined_value());
2713 context()->Plug(eax); 2715 context()->Plug(eax);
2714 } 2716 }
2715 2717
2716 2718
2717 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) { 2719 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
2718 ASSERT(args->length() == 0); 2720 ASSERT(args->length() == 0);
2719 2721
2720 Label slow_allocate_heapnumber; 2722 Label slow_allocate_heapnumber;
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
3761 // of the key to detect a named property. 3763 // of the key to detect a named property.
3762 if (prop != NULL) { 3764 if (prop != NULL) {
3763 assign_type = 3765 assign_type =
3764 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; 3766 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
3765 } 3767 }
3766 3768
3767 // Evaluate expression and get value. 3769 // Evaluate expression and get value.
3768 if (assign_type == VARIABLE) { 3770 if (assign_type == VARIABLE) {
3769 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); 3771 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL);
3770 AccumulatorValueContext context(this); 3772 AccumulatorValueContext context(this);
3771 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); 3773 EmitVariableLoad(expr->expression()->AsVariableProxy());
3772 } else { 3774 } else {
3773 // Reserve space for result of postfix operation. 3775 // Reserve space for result of postfix operation.
3774 if (expr->is_postfix() && !context()->IsEffect()) { 3776 if (expr->is_postfix() && !context()->IsEffect()) {
3775 __ push(Immediate(Smi::FromInt(0))); 3777 __ push(Immediate(Smi::FromInt(0)));
3776 } 3778 }
3777 if (assign_type == NAMED_PROPERTY) { 3779 if (assign_type == NAMED_PROPERTY) {
3778 // Put the object both on the stack and in the accumulator. 3780 // Put the object both on the stack and in the accumulator.
3779 VisitForAccumulatorValue(prop->obj()); 3781 VisitForAccumulatorValue(prop->obj());
3780 __ push(eax); 3782 __ push(eax);
3781 EmitNamedPropertyLoad(prop); 3783 EmitNamedPropertyLoad(prop);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 __ add(Operand(edx), Immediate(masm_->CodeObject())); 4249 __ add(Operand(edx), Immediate(masm_->CodeObject()));
4248 __ jmp(Operand(edx)); 4250 __ jmp(Operand(edx));
4249 } 4251 }
4250 4252
4251 4253
4252 #undef __ 4254 #undef __
4253 4255
4254 } } // namespace v8::internal 4256 } } // namespace v8::internal
4255 4257
4256 #endif // V8_TARGET_ARCH_IA32 4258 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698