| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 // Do a KEYED property load. | 1073 // Do a KEYED property load. |
| 1074 Visit(expr->key()); | 1074 Visit(expr->key()); |
| 1075 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1075 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1076 __ Call(ic, RelocInfo::CODE_TARGET); | 1076 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1077 // Drop key and receiver left on the stack by IC. | 1077 // Drop key and receiver left on the stack by IC. |
| 1078 __ pop(); | 1078 __ pop(); |
| 1079 } | 1079 } |
| 1080 DropAndMove(expr->context(), r0); | 1080 DropAndMove(expr->context(), r0); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 void FastCodeGenerator::EmitCallWithIC(Call* expr, RelocInfo::Mode reloc_info) { | 1083 void FastCodeGenerator::EmitCallWithIC(Call* expr, |
| 1084 Handle<Object> ignored, |
| 1085 RelocInfo::Mode mode) { |
| 1084 // Code common for calls using the IC. | 1086 // Code common for calls using the IC. |
| 1085 ZoneList<Expression*>* args = expr->arguments(); | 1087 ZoneList<Expression*>* args = expr->arguments(); |
| 1086 int arg_count = args->length(); | 1088 int arg_count = args->length(); |
| 1087 for (int i = 0; i < arg_count; i++) { | 1089 for (int i = 0; i < arg_count; i++) { |
| 1088 Visit(args->at(i)); | 1090 Visit(args->at(i)); |
| 1089 ASSERT_EQ(Expression::kValue, args->at(i)->context()); | 1091 ASSERT_EQ(Expression::kValue, args->at(i)->context()); |
| 1090 } | 1092 } |
| 1091 // Record source position for debugger. | 1093 // Record source position for debugger. |
| 1092 SetSourcePosition(expr->position()); | 1094 SetSourcePosition(expr->position()); |
| 1093 // Call the IC initialization code. | 1095 // Call the IC initialization code. |
| 1094 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, | 1096 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, |
| 1095 NOT_IN_LOOP); | 1097 NOT_IN_LOOP); |
| 1096 __ Call(ic, reloc_info); | 1098 __ Call(ic, mode); |
| 1097 // Restore context register. | 1099 // Restore context register. |
| 1098 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1100 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1099 // Discard the function left on TOS. | 1101 // Discard the function left on TOS. |
| 1100 DropAndMove(expr->context(), r0); | 1102 DropAndMove(expr->context(), r0); |
| 1101 } | 1103 } |
| 1102 | 1104 |
| 1103 | 1105 |
| 1104 void FastCodeGenerator::EmitCallWithStub(Call* expr) { | 1106 void FastCodeGenerator::EmitCallWithStub(Call* expr) { |
| 1105 // Code common for calls using the call stub. | 1107 // Code common for calls using the call stub. |
| 1106 ZoneList<Expression*>* args = expr->arguments(); | 1108 ZoneList<Expression*>* args = expr->arguments(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1126 | 1128 |
| 1127 if (var != NULL && var->is_possibly_eval()) { | 1129 if (var != NULL && var->is_possibly_eval()) { |
| 1128 // Call to the identifier 'eval'. | 1130 // Call to the identifier 'eval'. |
| 1129 UNREACHABLE(); | 1131 UNREACHABLE(); |
| 1130 } else if (var != NULL && !var->is_this() && var->is_global()) { | 1132 } else if (var != NULL && !var->is_this() && var->is_global()) { |
| 1131 // Call to a global variable. | 1133 // Call to a global variable. |
| 1132 __ mov(r1, Operand(var->name())); | 1134 __ mov(r1, Operand(var->name())); |
| 1133 // Push global object as receiver for the call IC lookup. | 1135 // Push global object as receiver for the call IC lookup. |
| 1134 __ ldr(r0, CodeGenerator::GlobalObject()); | 1136 __ ldr(r0, CodeGenerator::GlobalObject()); |
| 1135 __ stm(db_w, sp, r1.bit() | r0.bit()); | 1137 __ stm(db_w, sp, r1.bit() | r0.bit()); |
| 1136 EmitCallWithIC(expr, RelocInfo::CODE_TARGET_CONTEXT); | 1138 EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT); |
| 1137 } else if (var != NULL && var->slot() != NULL && | 1139 } else if (var != NULL && var->slot() != NULL && |
| 1138 var->slot()->type() == Slot::LOOKUP) { | 1140 var->slot()->type() == Slot::LOOKUP) { |
| 1139 // Call to a lookup slot. | 1141 // Call to a lookup slot. |
| 1140 UNREACHABLE(); | 1142 UNREACHABLE(); |
| 1141 } else if (fun->AsProperty() != NULL) { | 1143 } else if (fun->AsProperty() != NULL) { |
| 1142 // Call to an object property. | 1144 // Call to an object property. |
| 1143 Property* prop = fun->AsProperty(); | 1145 Property* prop = fun->AsProperty(); |
| 1144 Literal* key = prop->key()->AsLiteral(); | 1146 Literal* key = prop->key()->AsLiteral(); |
| 1145 if (key != NULL && key->handle()->IsSymbol()) { | 1147 if (key != NULL && key->handle()->IsSymbol()) { |
| 1146 // Call to a named property, use call IC. | 1148 // Call to a named property, use call IC. |
| 1147 __ mov(r0, Operand(key->handle())); | 1149 __ mov(r0, Operand(key->handle())); |
| 1148 __ push(r0); | 1150 __ push(r0); |
| 1149 Visit(prop->obj()); | 1151 Visit(prop->obj()); |
| 1150 EmitCallWithIC(expr, RelocInfo::CODE_TARGET); | 1152 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
| 1151 } else { | 1153 } else { |
| 1152 // Call to a keyed property, use keyed load IC followed by function | 1154 // Call to a keyed property, use keyed load IC followed by function |
| 1153 // call. | 1155 // call. |
| 1154 Visit(prop->obj()); | 1156 Visit(prop->obj()); |
| 1155 Visit(prop->key()); | 1157 Visit(prop->key()); |
| 1156 // Record source code position for IC call. | 1158 // Record source code position for IC call. |
| 1157 SetSourcePosition(prop->position()); | 1159 SetSourcePosition(prop->position()); |
| 1158 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1160 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1159 __ Call(ic, RelocInfo::CODE_TARGET); | 1161 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1160 // Load receiver object into r1. | 1162 // Load receiver object into r1. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 | 1737 |
| 1736 void FastCodeGenerator::ThrowException() { | 1738 void FastCodeGenerator::ThrowException() { |
| 1737 __ push(result_register()); | 1739 __ push(result_register()); |
| 1738 __ CallRuntime(Runtime::kThrow, 1); | 1740 __ CallRuntime(Runtime::kThrow, 1); |
| 1739 } | 1741 } |
| 1740 | 1742 |
| 1741 | 1743 |
| 1742 #undef __ | 1744 #undef __ |
| 1743 | 1745 |
| 1744 } } // namespace v8::internal | 1746 } } // namespace v8::internal |
| OLD | NEW |