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

Side by Side Diff: src/arm/full-codegen-arm.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/arm/codegen-arm.h ('k') | src/arm/lithium-arm.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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 } else if (prop != NULL) { 779 } else if (prop != NULL) {
780 // A const declaration aliasing a parameter is an illegal redeclaration. 780 // A const declaration aliasing a parameter is an illegal redeclaration.
781 ASSERT(mode != Variable::CONST); 781 ASSERT(mode != Variable::CONST);
782 if (function != NULL) { 782 if (function != NULL) {
783 // We are declaring a function that rewrites to a property. 783 // We are declaring a function that rewrites to a property.
784 // Use (keyed) IC to set the initial value. We cannot visit the 784 // Use (keyed) IC to set the initial value. We cannot visit the
785 // rewrite because it's shared and we risk recording duplicate AST 785 // rewrite because it's shared and we risk recording duplicate AST
786 // IDs for bailouts from optimized code. 786 // IDs for bailouts from optimized code.
787 ASSERT(prop->obj()->AsVariableProxy() != NULL); 787 ASSERT(prop->obj()->AsVariableProxy() != NULL);
788 { AccumulatorValueContext for_object(this); 788 { AccumulatorValueContext for_object(this);
789 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); 789 EmitVariableLoad(prop->obj()->AsVariableProxy());
790 } 790 }
791 791
792 __ push(r0); 792 __ push(r0);
793 VisitForAccumulatorValue(function); 793 VisitForAccumulatorValue(function);
794 __ pop(r2); 794 __ pop(r2);
795 795
796 ASSERT(prop->key()->AsLiteral() != NULL && 796 ASSERT(prop->key()->AsLiteral() != NULL &&
797 prop->key()->AsLiteral()->handle()->IsSmi()); 797 prop->key()->AsLiteral()->handle()->IsSmi());
798 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); 798 __ mov(r1, Operand(prop->key()->AsLiteral()->handle()));
799 799
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 : Heap::kFalseValueRootIndex); 1116 : Heap::kFalseValueRootIndex);
1117 __ Push(cp, r0, r1); 1117 __ Push(cp, r0, r1);
1118 __ CallRuntime(Runtime::kNewClosure, 3); 1118 __ CallRuntime(Runtime::kNewClosure, 3);
1119 } 1119 }
1120 context()->Plug(r0); 1120 context()->Plug(r0);
1121 } 1121 }
1122 1122
1123 1123
1124 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 1124 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
1125 Comment cmnt(masm_, "[ VariableProxy"); 1125 Comment cmnt(masm_, "[ VariableProxy");
1126 EmitVariableLoad(expr->var()); 1126 EmitVariableLoad(expr);
1127 } 1127 }
1128 1128
1129 1129
1130 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( 1130 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions(
1131 Slot* slot, 1131 Slot* slot,
1132 TypeofState typeof_state, 1132 TypeofState typeof_state,
1133 Label* slow) { 1133 Label* slow) {
1134 Register current = cp; 1134 Register current = cp;
1135 Register next = r1; 1135 Register next = r1;
1136 Register temp = r2; 1136 Register temp = r2;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 isolate()->builtins()->KeyedLoadIC_Initialize(); 1265 isolate()->builtins()->KeyedLoadIC_Initialize();
1266 __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); 1266 __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
1267 __ jmp(done); 1267 __ jmp(done);
1268 } 1268 }
1269 } 1269 }
1270 } 1270 }
1271 } 1271 }
1272 } 1272 }
1273 1273
1274 1274
1275 void FullCodeGenerator::EmitVariableLoad(Variable* var) { 1275 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
1276 // Record position before possible IC call.
1277 SetSourcePosition(proxy->position());
1278 Variable* var = proxy->var();
1279
1276 // Three cases: non-this global variables, lookup slots, and all other 1280 // Three cases: non-this global variables, lookup slots, and all other
1277 // types of slots. 1281 // types of slots.
1278 Slot* slot = var->AsSlot(); 1282 Slot* slot = var->AsSlot();
1279 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); 1283 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL));
1280 1284
1281 if (slot == NULL) { 1285 if (slot == NULL) {
1282 Comment cmnt(masm_, "Global variable"); 1286 Comment cmnt(masm_, "Global variable");
1283 // Use inline caching. Variable name is passed in r2 and the global 1287 // Use inline caching. Variable name is passed in r2 and the global
1284 // object (receiver) in r0. 1288 // object (receiver) in r0.
1285 __ ldr(r0, GlobalObjectOperand()); 1289 __ ldr(r0, GlobalObjectOperand());
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 } 1601 }
1598 break; 1602 break;
1599 } 1603 }
1600 1604
1601 // For compound assignments we need another deoptimization point after the 1605 // For compound assignments we need another deoptimization point after the
1602 // variable/property load. 1606 // variable/property load.
1603 if (expr->is_compound()) { 1607 if (expr->is_compound()) {
1604 { AccumulatorValueContext context(this); 1608 { AccumulatorValueContext context(this);
1605 switch (assign_type) { 1609 switch (assign_type) {
1606 case VARIABLE: 1610 case VARIABLE:
1607 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); 1611 EmitVariableLoad(expr->target()->AsVariableProxy());
1608 PrepareForBailout(expr->target(), TOS_REG); 1612 PrepareForBailout(expr->target(), TOS_REG);
1609 break; 1613 break;
1610 case NAMED_PROPERTY: 1614 case NAMED_PROPERTY:
1611 EmitNamedPropertyLoad(property); 1615 EmitNamedPropertyLoad(property);
1612 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1616 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1613 break; 1617 break;
1614 case KEYED_PROPERTY: 1618 case KEYED_PROPERTY:
1615 EmitKeyedPropertyLoad(property); 1619 EmitKeyedPropertyLoad(property);
1616 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); 1620 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1617 break; 1621 break;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); 2759 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset));
2756 __ b(&done); 2760 __ b(&done);
2757 2761
2758 // Functions have class 'Function'. 2762 // Functions have class 'Function'.
2759 __ bind(&function); 2763 __ bind(&function);
2760 __ LoadRoot(r0, Heap::kfunction_class_symbolRootIndex); 2764 __ LoadRoot(r0, Heap::kfunction_class_symbolRootIndex);
2761 __ jmp(&done); 2765 __ jmp(&done);
2762 2766
2763 // Objects with a non-function constructor have class 'Object'. 2767 // Objects with a non-function constructor have class 'Object'.
2764 __ bind(&non_function_constructor); 2768 __ bind(&non_function_constructor);
2765 __ LoadRoot(r0, Heap::kfunction_class_symbolRootIndex); 2769 __ LoadRoot(r0, Heap::kObject_symbolRootIndex);
2766 __ jmp(&done); 2770 __ jmp(&done);
2767 2771
2768 // Non-JS objects have class null. 2772 // Non-JS objects have class null.
2769 __ bind(&null); 2773 __ bind(&null);
2770 __ LoadRoot(r0, Heap::kNullValueRootIndex); 2774 __ LoadRoot(r0, Heap::kNullValueRootIndex);
2771 2775
2772 // All done. 2776 // All done.
2773 __ bind(&done); 2777 __ bind(&done);
2774 2778
2775 context()->Plug(r0); 2779 context()->Plug(r0);
2776 } 2780 }
2777 2781
2778 2782
2779 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) { 2783 void FullCodeGenerator::EmitLog(ZoneList<Expression*>* args) {
2780 // Conditionally generate a log call. 2784 // Conditionally generate a log call.
2781 // Args: 2785 // Args:
2782 // 0 (literal string): The type of logging (corresponds to the flags). 2786 // 0 (literal string): The type of logging (corresponds to the flags).
2783 // This is used to determine whether or not to generate the log call. 2787 // This is used to determine whether or not to generate the log call.
2784 // 1 (string): Format string. Access the string at argument index 2 2788 // 1 (string): Format string. Access the string at argument index 2
2785 // with '%2s' (see Logger::LogRuntime for all the formats). 2789 // with '%2s' (see Logger::LogRuntime for all the formats).
2786 // 2 (array): Arguments to the format string. 2790 // 2 (array): Arguments to the format string.
2787 ASSERT_EQ(args->length(), 3); 2791 ASSERT_EQ(args->length(), 3);
2788 #ifdef ENABLE_LOGGING_AND_PROFILING
2789 if (CodeGenerator::ShouldGenerateLog(args->at(0))) { 2792 if (CodeGenerator::ShouldGenerateLog(args->at(0))) {
2790 VisitForStackValue(args->at(1)); 2793 VisitForStackValue(args->at(1));
2791 VisitForStackValue(args->at(2)); 2794 VisitForStackValue(args->at(2));
2792 __ CallRuntime(Runtime::kLog, 2); 2795 __ CallRuntime(Runtime::kLog, 2);
2793 } 2796 }
2794 #endif 2797
2795 // Finally, we're expected to leave a value on the top of the stack. 2798 // Finally, we're expected to leave a value on the top of the stack.
2796 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 2799 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
2797 context()->Plug(r0); 2800 context()->Plug(r0);
2798 } 2801 }
2799 2802
2800 2803
2801 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) { 2804 void FullCodeGenerator::EmitRandomHeapNumber(ZoneList<Expression*>* args) {
2802 ASSERT(args->length() == 0); 2805 ASSERT(args->length() == 0);
2803 2806
2804 Label slow_allocate_heapnumber; 2807 Label slow_allocate_heapnumber;
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
3833 // of the key to detect a named property. 3836 // of the key to detect a named property.
3834 if (prop != NULL) { 3837 if (prop != NULL) {
3835 assign_type = 3838 assign_type =
3836 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; 3839 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
3837 } 3840 }
3838 3841
3839 // Evaluate expression and get value. 3842 // Evaluate expression and get value.
3840 if (assign_type == VARIABLE) { 3843 if (assign_type == VARIABLE) {
3841 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); 3844 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL);
3842 AccumulatorValueContext context(this); 3845 AccumulatorValueContext context(this);
3843 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); 3846 EmitVariableLoad(expr->expression()->AsVariableProxy());
3844 } else { 3847 } else {
3845 // Reserve space for result of postfix operation. 3848 // Reserve space for result of postfix operation.
3846 if (expr->is_postfix() && !context()->IsEffect()) { 3849 if (expr->is_postfix() && !context()->IsEffect()) {
3847 __ mov(ip, Operand(Smi::FromInt(0))); 3850 __ mov(ip, Operand(Smi::FromInt(0)));
3848 __ push(ip); 3851 __ push(ip);
3849 } 3852 }
3850 if (assign_type == NAMED_PROPERTY) { 3853 if (assign_type == NAMED_PROPERTY) {
3851 // Put the object both on the stack and in the accumulator. 3854 // Put the object both on the stack and in the accumulator.
3852 VisitForAccumulatorValue(prop->obj()); 3855 VisitForAccumulatorValue(prop->obj());
3853 __ push(r0); 3856 __ push(r0);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
4313 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4316 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4314 __ add(pc, r1, Operand(masm_->CodeObject())); 4317 __ add(pc, r1, Operand(masm_->CodeObject()));
4315 } 4318 }
4316 4319
4317 4320
4318 #undef __ 4321 #undef __
4319 4322
4320 } } // namespace v8::internal 4323 } } // namespace v8::internal
4321 4324
4322 #endif // V8_TARGET_ARCH_ARM 4325 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698