| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 void Ia32CodeGenerator::LoadTypeofExpression(Expression* x) { | 871 void Ia32CodeGenerator::LoadTypeofExpression(Expression* x) { |
| 872 Variable* variable = x->AsVariableProxy()->AsVariable(); | 872 Variable* variable = x->AsVariableProxy()->AsVariable(); |
| 873 if (variable != NULL && !variable->is_this() && variable->is_global()) { | 873 if (variable != NULL && !variable->is_this() && variable->is_global()) { |
| 874 // NOTE: This is somewhat nasty. We force the compiler to load | 874 // NOTE: This is somewhat nasty. We force the compiler to load |
| 875 // the variable as if through '<global>.<variable>' to make sure we | 875 // the variable as if through '<global>.<variable>' to make sure we |
| 876 // do not get reference errors. | 876 // do not get reference errors. |
| 877 Slot global(variable, Slot::CONTEXT, Context::GLOBAL_INDEX); | 877 Slot global(variable, Slot::CONTEXT, Context::GLOBAL_INDEX); |
| 878 Literal key(variable->name()); | 878 Literal key(variable->name()); |
| 879 // TODO(1241834): Fetch the position from the variable instead of using | 879 // TODO(1241834): Fetch the position from the variable instead of using |
| 880 // no position. | 880 // no position. |
| 881 Property property(&global, &key, kNoPosition); | 881 Property property(&global, &key, RelocInfo::kNoPosition); |
| 882 Load(&property); | 882 Load(&property); |
| 883 } else { | 883 } else { |
| 884 Load(x, CodeGenState::LOAD_TYPEOF_EXPR); | 884 Load(x, CodeGenState::LOAD_TYPEOF_EXPR); |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 | 887 |
| 888 | 888 |
| 889 Reference::Reference(Ia32CodeGenerator* cgen, Expression* expression) | 889 Reference::Reference(Ia32CodeGenerator* cgen, Expression* expression) |
| 890 : cgen_(cgen), expression_(expression), type_(ILLEGAL) { | 890 : cgen_(cgen), expression_(expression), type_(ILLEGAL) { |
| 891 cgen->LoadReference(this); | 891 cgen->LoadReference(this); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 // Compute the name of the property. | 1197 // Compute the name of the property. |
| 1198 Literal* literal = key->AsLiteral(); | 1198 Literal* literal = key->AsLiteral(); |
| 1199 Handle<String> name(String::cast(*literal->handle())); | 1199 Handle<String> name(String::cast(*literal->handle())); |
| 1200 | 1200 |
| 1201 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1201 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 1202 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable(); | 1202 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable(); |
| 1203 // Setup the name register. | 1203 // Setup the name register. |
| 1204 __ Set(ecx, Immediate(name)); | 1204 __ Set(ecx, Immediate(name)); |
| 1205 if (var != NULL) { | 1205 if (var != NULL) { |
| 1206 ASSERT(var->is_global()); | 1206 ASSERT(var->is_global()); |
| 1207 __ call(ic, code_target_context); | 1207 __ call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 1208 } else { | 1208 } else { |
| 1209 __ call(ic, code_target); | 1209 __ call(ic, RelocInfo::CODE_TARGET); |
| 1210 } | 1210 } |
| 1211 } else { | 1211 } else { |
| 1212 // Access keyed property. | 1212 // Access keyed property. |
| 1213 ASSERT(type == Reference::KEYED); | 1213 ASSERT(type == Reference::KEYED); |
| 1214 | 1214 |
| 1215 // Call IC code. | 1215 // Call IC code. |
| 1216 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1216 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1217 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable(); | 1217 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable(); |
| 1218 if (var != NULL) { | 1218 if (var != NULL) { |
| 1219 ASSERT(var->is_global()); | 1219 ASSERT(var->is_global()); |
| 1220 __ call(ic, code_target_context); | 1220 __ call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 1221 } else { | 1221 } else { |
| 1222 __ call(ic, code_target); | 1222 __ call(ic, RelocInfo::CODE_TARGET); |
| 1223 } | 1223 } |
| 1224 } | 1224 } |
| 1225 __ push(eax); // IC call leaves result in eax, push it out | 1225 __ push(eax); // IC call leaves result in eax, push it out |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 | 1228 |
| 1229 void Ia32CodeGenerator::SetReferenceProperty(MacroAssembler* masm, | 1229 void Ia32CodeGenerator::SetReferenceProperty(MacroAssembler* masm, |
| 1230 Reference* ref, | 1230 Reference* ref, |
| 1231 Expression* key) { | 1231 Expression* key) { |
| 1232 ASSERT(!ref->is_illegal()); | 1232 ASSERT(!ref->is_illegal()); |
| 1233 Reference::Type type = ref->type(); | 1233 Reference::Type type = ref->type(); |
| 1234 | 1234 |
| 1235 if (type == Reference::NAMED) { | 1235 if (type == Reference::NAMED) { |
| 1236 // Compute the name of the property. | 1236 // Compute the name of the property. |
| 1237 Literal* literal = key->AsLiteral(); | 1237 Literal* literal = key->AsLiteral(); |
| 1238 Handle<String> name(String::cast(*literal->handle())); | 1238 Handle<String> name(String::cast(*literal->handle())); |
| 1239 | 1239 |
| 1240 // Call the appropriate IC code. | 1240 // Call the appropriate IC code. |
| 1241 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1241 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
| 1242 // TODO(1222589): Make the IC grab the values from the stack. | 1242 // TODO(1222589): Make the IC grab the values from the stack. |
| 1243 masm->pop(eax); | 1243 masm->pop(eax); |
| 1244 // Setup the name register. | 1244 // Setup the name register. |
| 1245 masm->Set(ecx, Immediate(name)); | 1245 masm->Set(ecx, Immediate(name)); |
| 1246 masm->call(ic, code_target); | 1246 masm->call(ic, RelocInfo::CODE_TARGET); |
| 1247 } else { | 1247 } else { |
| 1248 // Access keyed property. | 1248 // Access keyed property. |
| 1249 ASSERT(type == Reference::KEYED); | 1249 ASSERT(type == Reference::KEYED); |
| 1250 | 1250 |
| 1251 // Call IC code. | 1251 // Call IC code. |
| 1252 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1252 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
| 1253 // TODO(1222589): Make the IC grab the values from the stack. | 1253 // TODO(1222589): Make the IC grab the values from the stack. |
| 1254 masm->pop(eax); | 1254 masm->pop(eax); |
| 1255 masm->call(ic, code_target); | 1255 masm->call(ic, RelocInfo::CODE_TARGET); |
| 1256 } | 1256 } |
| 1257 masm->push(eax); // IC call leaves result in eax, push it out | 1257 masm->push(eax); // IC call leaves result in eax, push it out |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 | 1260 |
| 1261 #undef __ | 1261 #undef __ |
| 1262 #define __ masm-> | 1262 #define __ masm-> |
| 1263 | 1263 |
| 1264 | 1264 |
| 1265 class FloatingPointHelper : public AllStatic { | 1265 class FloatingPointHelper : public AllStatic { |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 // Fast-case: Just invoke the function. | 2621 // Fast-case: Just invoke the function. |
| 2622 ParameterCount actual(argc_); | 2622 ParameterCount actual(argc_); |
| 2623 masm->InvokeFunction(edi, actual, JUMP_FUNCTION); | 2623 masm->InvokeFunction(edi, actual, JUMP_FUNCTION); |
| 2624 | 2624 |
| 2625 // Slow-case: Non-function called. | 2625 // Slow-case: Non-function called. |
| 2626 masm->bind(&slow); | 2626 masm->bind(&slow); |
| 2627 masm->Set(eax, Immediate(argc_)); | 2627 masm->Set(eax, Immediate(argc_)); |
| 2628 masm->Set(ebx, Immediate(0)); | 2628 masm->Set(ebx, Immediate(0)); |
| 2629 masm->GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 2629 masm->GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); |
| 2630 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 2630 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); |
| 2631 masm->jmp(adaptor, code_target); | 2631 masm->jmp(adaptor, RelocInfo::CODE_TARGET); |
| 2632 } | 2632 } |
| 2633 | 2633 |
| 2634 | 2634 |
| 2635 // Call the function just below TOS on the stack with the given | 2635 // Call the function just below TOS on the stack with the given |
| 2636 // arguments. The receiver is the TOS. | 2636 // arguments. The receiver is the TOS. |
| 2637 void Ia32CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, | 2637 void Ia32CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, |
| 2638 int position) { | 2638 int position) { |
| 2639 // Push the arguments ("left-to-right") on the stack. | 2639 // Push the arguments ("left-to-right") on the stack. |
| 2640 for (int i = 0; i < args->length(); i++) Load(args->at(i)); | 2640 for (int i = 0; i < args->length(); i++) Load(args->at(i)); |
| 2641 | 2641 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2951 // check range of value, if outside [0..length-1] jump to default/end label. | 2951 // check range of value, if outside [0..length-1] jump to default/end label. |
| 2952 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 2952 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 2953 if (min_index != 0) { | 2953 if (min_index != 0) { |
| 2954 __ sub(Operand(eax), Immediate(min_index * 2)); // smi subtraction | 2954 __ sub(Operand(eax), Immediate(min_index * 2)); // smi subtraction |
| 2955 } | 2955 } |
| 2956 __ test(eax, Immediate(0x80000000 | kSmiTagMask)); // negative or not smi | 2956 __ test(eax, Immediate(0x80000000 | kSmiTagMask)); // negative or not smi |
| 2957 __ j(not_equal, fail_label, not_taken); | 2957 __ j(not_equal, fail_label, not_taken); |
| 2958 __ cmp(eax, range * 2); | 2958 __ cmp(eax, range * 2); |
| 2959 __ j(greater_equal, fail_label, not_taken); | 2959 __ j(greater_equal, fail_label, not_taken); |
| 2960 | 2960 |
| 2961 __ jmp(Operand(eax, times_2, 0x0, internal_reference)); // 0 is placeholder | 2961 // 0 is placeholder. |
| 2962 __ jmp(Operand(eax, times_2, 0x0, RelocInfo::INTERNAL_REFERENCE)); |
| 2962 // calculate address to overwrite later with actual address of table. | 2963 // calculate address to overwrite later with actual address of table. |
| 2963 int32_t jump_table_ref = __ pc_offset() - sizeof(int32_t); | 2964 int32_t jump_table_ref = __ pc_offset() - sizeof(int32_t); |
| 2964 | 2965 |
| 2965 __ Align(4); | 2966 __ Align(4); |
| 2966 __ bind(&table_start); | 2967 __ bind(&table_start); |
| 2967 __ WriteInternalReference(jump_table_ref, table_start); | 2968 __ WriteInternalReference(jump_table_ref, table_start); |
| 2968 | 2969 |
| 2969 for (int i = 0; i < range; i++) { | 2970 for (int i = 0; i < range; i++) { |
| 2970 __ dd(0x0, internal_reference); // table entry, 0 is placeholder | 2971 __ dd(0x0, RelocInfo::INTERNAL_REFERENCE); // table entry, 0 is placeholder |
| 2971 } | 2972 } |
| 2972 } | 2973 } |
| 2973 | 2974 |
| 2974 | 2975 |
| 2975 // Populate an empty jump table with the adresses of bound labels. | 2976 // Populate an empty jump table with the adresses of bound labels. |
| 2976 void Ia32CodeGenerator::PopulateFastCaseSwitchJumpTable( | 2977 void Ia32CodeGenerator::PopulateFastCaseSwitchJumpTable( |
| 2977 Label &table_start, SmartPointer<Label*> &case_targets, int table_size) { | 2978 Label &table_start, SmartPointer<Label*> &case_targets, int table_size) { |
| 2978 for (int i = 0; i < table_size; i++) { | 2979 for (int i = 0; i < table_size; i++) { |
| 2979 int table_entry_pos = table_start.pos() + i * sizeof(uint32_t); | 2980 int table_entry_pos = table_start.pos() + i * sizeof(uint32_t); |
| 2980 __ WriteInternalReference(table_entry_pos, *case_targets[i]); | 2981 __ WriteInternalReference(table_entry_pos, *case_targets[i]); |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3886 case ObjectLiteral::Property::CONSTANT: break; | 3887 case ObjectLiteral::Property::CONSTANT: break; |
| 3887 case ObjectLiteral::Property::COMPUTED: { | 3888 case ObjectLiteral::Property::COMPUTED: { |
| 3888 Handle<Object> key(property->key()->handle()); | 3889 Handle<Object> key(property->key()->handle()); |
| 3889 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 3890 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
| 3890 if (key->IsSymbol()) { | 3891 if (key->IsSymbol()) { |
| 3891 __ mov(eax, TOS); | 3892 __ mov(eax, TOS); |
| 3892 __ push(eax); | 3893 __ push(eax); |
| 3893 Load(property->value()); | 3894 Load(property->value()); |
| 3894 __ pop(eax); | 3895 __ pop(eax); |
| 3895 __ Set(ecx, Immediate(key)); | 3896 __ Set(ecx, Immediate(key)); |
| 3896 __ call(ic, code_target); | 3897 __ call(ic, RelocInfo::CODE_TARGET); |
| 3897 __ add(Operand(esp), Immediate(kPointerSize)); | 3898 __ add(Operand(esp), Immediate(kPointerSize)); |
| 3898 // Ignore result. | 3899 // Ignore result. |
| 3899 break; | 3900 break; |
| 3900 } | 3901 } |
| 3901 // Fall through | 3902 // Fall through |
| 3902 } | 3903 } |
| 3903 case ObjectLiteral::Property::PROTOTYPE: { | 3904 case ObjectLiteral::Property::PROTOTYPE: { |
| 3904 __ mov(eax, TOS); | 3905 __ mov(eax, TOS); |
| 3905 __ push(eax); | 3906 __ push(eax); |
| 3906 Load(property->key()); | 3907 Load(property->key()); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 LoadGlobal(); | 4088 LoadGlobal(); |
| 4088 | 4089 |
| 4089 // Load the arguments. | 4090 // Load the arguments. |
| 4090 for (int i = 0; i < args->length(); i++) { | 4091 for (int i = 0; i < args->length(); i++) { |
| 4091 Load(args->at(i)); | 4092 Load(args->at(i)); |
| 4092 } | 4093 } |
| 4093 | 4094 |
| 4094 // Setup the receiver register and call the IC initialization code. | 4095 // Setup the receiver register and call the IC initialization code. |
| 4095 Handle<Code> stub = ComputeCallInitialize(args->length()); | 4096 Handle<Code> stub = ComputeCallInitialize(args->length()); |
| 4096 __ RecordPosition(node->position()); | 4097 __ RecordPosition(node->position()); |
| 4097 __ call(stub, code_target_context); | 4098 __ call(stub, RelocInfo::CODE_TARGET_CONTEXT); |
| 4098 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4099 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4099 | 4100 |
| 4100 // Overwrite the function on the stack with the result. | 4101 // Overwrite the function on the stack with the result. |
| 4101 __ mov(TOS, eax); | 4102 __ mov(TOS, eax); |
| 4102 | 4103 |
| 4103 } else if (var != NULL && var->slot() != NULL && | 4104 } else if (var != NULL && var->slot() != NULL && |
| 4104 var->slot()->type() == Slot::LOOKUP) { | 4105 var->slot()->type() == Slot::LOOKUP) { |
| 4105 // ---------------------------------- | 4106 // ---------------------------------- |
| 4106 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj | 4107 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj |
| 4107 // ---------------------------------- | 4108 // ---------------------------------- |
| (...skipping 23 matching lines...) Expand all Loading... |
| 4131 // Push the name of the function and the receiver onto the stack. | 4132 // Push the name of the function and the receiver onto the stack. |
| 4132 __ push(Immediate(literal->handle())); | 4133 __ push(Immediate(literal->handle())); |
| 4133 Load(property->obj()); | 4134 Load(property->obj()); |
| 4134 | 4135 |
| 4135 // Load the arguments. | 4136 // Load the arguments. |
| 4136 for (int i = 0; i < args->length(); i++) Load(args->at(i)); | 4137 for (int i = 0; i < args->length(); i++) Load(args->at(i)); |
| 4137 | 4138 |
| 4138 // Call the IC initialization code. | 4139 // Call the IC initialization code. |
| 4139 Handle<Code> stub = ComputeCallInitialize(args->length()); | 4140 Handle<Code> stub = ComputeCallInitialize(args->length()); |
| 4140 __ RecordPosition(node->position()); | 4141 __ RecordPosition(node->position()); |
| 4141 __ call(stub, code_target); | 4142 __ call(stub, RelocInfo::CODE_TARGET); |
| 4142 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4143 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4143 | 4144 |
| 4144 // Overwrite the function on the stack with the result. | 4145 // Overwrite the function on the stack with the result. |
| 4145 __ mov(TOS, eax); | 4146 __ mov(TOS, eax); |
| 4146 | 4147 |
| 4147 } else { | 4148 } else { |
| 4148 // ------------------------------------------- | 4149 // ------------------------------------------- |
| 4149 // JavaScript example: 'array[index](1, 2, 3)' | 4150 // JavaScript example: 'array[index](1, 2, 3)' |
| 4150 // ------------------------------------------- | 4151 // ------------------------------------------- |
| 4151 | 4152 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 __ Set(eax, Immediate(args->length())); | 4202 __ Set(eax, Immediate(args->length())); |
| 4202 | 4203 |
| 4203 // Load the function into temporary function slot as per calling | 4204 // Load the function into temporary function slot as per calling |
| 4204 // convention. | 4205 // convention. |
| 4205 __ mov(edi, Operand(esp, (args->length() + 1) * kPointerSize)); | 4206 __ mov(edi, Operand(esp, (args->length() + 1) * kPointerSize)); |
| 4206 | 4207 |
| 4207 // Call the construct call builtin that handles allocation and | 4208 // Call the construct call builtin that handles allocation and |
| 4208 // constructor invocation. | 4209 // constructor invocation. |
| 4209 __ RecordPosition(node->position()); | 4210 __ RecordPosition(node->position()); |
| 4210 __ call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), | 4211 __ call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), |
| 4211 js_construct_call); | 4212 RelocInfo::CONSTRUCT_CALL); |
| 4212 __ mov(TOS, eax); // discard the function and "push" the newly created object | 4213 __ mov(TOS, eax); // discard the function and "push" the newly created object |
| 4213 } | 4214 } |
| 4214 | 4215 |
| 4215 | 4216 |
| 4216 void Ia32CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { | 4217 void Ia32CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) { |
| 4217 ASSERT(args->length() == 1); | 4218 ASSERT(args->length() == 1); |
| 4218 Load(args->at(0)); | 4219 Load(args->at(0)); |
| 4219 __ pop(eax); | 4220 __ pop(eax); |
| 4220 __ test(eax, Immediate(kSmiTagMask)); | 4221 __ test(eax, Immediate(kSmiTagMask)); |
| 4221 cc_reg_ = zero; | 4222 cc_reg_ = zero; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4496 Load(args->at(i)); | 4497 Load(args->at(i)); |
| 4497 | 4498 |
| 4498 if (function != NULL) { | 4499 if (function != NULL) { |
| 4499 // Call the C runtime function. | 4500 // Call the C runtime function. |
| 4500 __ CallRuntime(function, args->length()); | 4501 __ CallRuntime(function, args->length()); |
| 4501 __ push(eax); | 4502 __ push(eax); |
| 4502 } else { | 4503 } else { |
| 4503 // Call the JS runtime function. | 4504 // Call the JS runtime function. |
| 4504 Handle<Code> stub = ComputeCallInitialize(args->length()); | 4505 Handle<Code> stub = ComputeCallInitialize(args->length()); |
| 4505 __ Set(eax, Immediate(args->length())); | 4506 __ Set(eax, Immediate(args->length())); |
| 4506 __ call(stub, code_target); | 4507 __ call(stub, RelocInfo::CODE_TARGET); |
| 4507 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4508 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4508 __ mov(TOS, eax); | 4509 __ mov(TOS, eax); |
| 4509 } | 4510 } |
| 4510 } | 4511 } |
| 4511 | 4512 |
| 4512 | 4513 |
| 4513 void Ia32CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { | 4514 void Ia32CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { |
| 4514 Comment cmnt(masm_, "[ UnaryOperation"); | 4515 Comment cmnt(masm_, "[ UnaryOperation"); |
| 4515 | 4516 |
| 4516 Token::Value op = node->op(); | 4517 Token::Value op = node->op(); |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5156 | 5157 |
| 5157 Load(left); | 5158 Load(left); |
| 5158 Load(right); | 5159 Load(right); |
| 5159 Comparison(cc, strict); | 5160 Comparison(cc, strict); |
| 5160 } | 5161 } |
| 5161 | 5162 |
| 5162 | 5163 |
| 5163 void Ia32CodeGenerator::RecordStatementPosition(Node* node) { | 5164 void Ia32CodeGenerator::RecordStatementPosition(Node* node) { |
| 5164 if (FLAG_debug_info) { | 5165 if (FLAG_debug_info) { |
| 5165 int pos = node->statement_pos(); | 5166 int pos = node->statement_pos(); |
| 5166 if (pos != kNoPosition) { | 5167 if (pos != RelocInfo::kNoPosition) { |
| 5167 __ RecordStatementPosition(pos); | 5168 __ RecordStatementPosition(pos); |
| 5168 } | 5169 } |
| 5169 } | 5170 } |
| 5170 } | 5171 } |
| 5171 | 5172 |
| 5172 | 5173 |
| 5173 void Ia32CodeGenerator::EnterJSFrame() { | 5174 void Ia32CodeGenerator::EnterJSFrame() { |
| 5174 __ push(ebp); | 5175 __ push(ebp); |
| 5175 __ mov(ebp, Operand(esp)); | 5176 __ mov(ebp, Operand(esp)); |
| 5176 | 5177 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5247 bool do_gc, | 5248 bool do_gc, |
| 5248 bool do_restore) { | 5249 bool do_restore) { |
| 5249 // eax: result parameter for PerformGC, if any | 5250 // eax: result parameter for PerformGC, if any |
| 5250 // ebx: pointer to C function (C callee-saved) | 5251 // ebx: pointer to C function (C callee-saved) |
| 5251 // ebp: frame pointer (restored after C call) | 5252 // ebp: frame pointer (restored after C call) |
| 5252 // esp: stack pointer (restored after C call) | 5253 // esp: stack pointer (restored after C call) |
| 5253 // edi: number of arguments including receiver (C callee-saved) | 5254 // edi: number of arguments including receiver (C callee-saved) |
| 5254 | 5255 |
| 5255 if (do_gc) { | 5256 if (do_gc) { |
| 5256 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result. | 5257 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result. |
| 5257 __ call(FUNCTION_ADDR(Runtime::PerformGC), runtime_entry); | 5258 __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); |
| 5258 } | 5259 } |
| 5259 | 5260 |
| 5260 // Call C function. | 5261 // Call C function. |
| 5261 __ lea(eax, Operand(ebp, | 5262 __ lea(eax, Operand(ebp, |
| 5262 edi, | 5263 edi, |
| 5263 times_4, | 5264 times_4, |
| 5264 StandardFrameConstants::kCallerSPOffset - kPointerSize)); | 5265 StandardFrameConstants::kCallerSPOffset - kPointerSize)); |
| 5265 __ mov(Operand(esp, 0 * kPointerSize), edi); // argc. | 5266 __ mov(Operand(esp, 0 * kPointerSize), edi); // argc. |
| 5266 __ mov(Operand(esp, 1 * kPointerSize), eax); // argv. | 5267 __ mov(Operand(esp, 1 * kPointerSize), eax); // argv. |
| 5267 __ call(Operand(ebx)); | 5268 __ call(Operand(ebx)); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5583 bool is_eval) { | 5584 bool is_eval) { |
| 5584 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); | 5585 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); |
| 5585 if (!code.is_null()) { | 5586 if (!code.is_null()) { |
| 5586 Counters::total_compiled_code_size.Increment(code->instruction_size()); | 5587 Counters::total_compiled_code_size.Increment(code->instruction_size()); |
| 5587 } | 5588 } |
| 5588 return code; | 5589 return code; |
| 5589 } | 5590 } |
| 5590 | 5591 |
| 5591 | 5592 |
| 5592 } } // namespace v8::internal | 5593 } } // namespace v8::internal |
| OLD | NEW |