| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 | 814 |
| 815 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { | 815 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { |
| 816 if (kind_ == Code::KEYED_CALL_IC) { | 816 if (kind_ == Code::KEYED_CALL_IC) { |
| 817 __ Cmp(rcx, Handle<String>(name)); | 817 __ Cmp(rcx, Handle<String>(name)); |
| 818 __ j(not_equal, miss); | 818 __ j(not_equal, miss); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 | 822 |
| 823 void CallStubCompiler::GenerateMissBranch() { | 823 Object* CallStubCompiler::GenerateMissBranch() { |
| 824 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); | 824 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
| 825 __ Jump(ic, RelocInfo::CODE_TARGET); | 825 if (obj->IsFailure()) return obj; |
| 826 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
| 827 return obj; |
| 826 } | 828 } |
| 827 | 829 |
| 828 | 830 |
| 829 Object* CallStubCompiler::CompileCallConstant(Object* object, | 831 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 830 JSObject* holder, | 832 JSObject* holder, |
| 831 JSFunction* function, | 833 JSFunction* function, |
| 832 String* name, | 834 String* name, |
| 833 StubCompiler::CheckType check) { | 835 StubCompiler::CheckType check) { |
| 834 // ----------- S t a t e ------------- | 836 // ----------- S t a t e ------------- |
| 835 // rcx : function name | 837 // rcx : function name |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 } | 970 } |
| 969 | 971 |
| 970 // Handle call cache miss. | 972 // Handle call cache miss. |
| 971 __ bind(&miss); | 973 __ bind(&miss); |
| 972 if (depth != kInvalidProtoDepth) { | 974 if (depth != kInvalidProtoDepth) { |
| 973 FreeSpaceForFastApiCall(masm(), rax); | 975 FreeSpaceForFastApiCall(masm(), rax); |
| 974 } | 976 } |
| 975 | 977 |
| 976 // Handle call cache miss. | 978 // Handle call cache miss. |
| 977 __ bind(&miss_in_smi_check); | 979 __ bind(&miss_in_smi_check); |
| 978 GenerateMissBranch(); | 980 Object* obj = GenerateMissBranch(); |
| 981 if (obj->IsFailure()) return obj; |
| 979 | 982 |
| 980 // Return the generated code. | 983 // Return the generated code. |
| 981 return GetCode(function); | 984 return GetCode(function); |
| 982 } | 985 } |
| 983 | 986 |
| 984 | 987 |
| 985 Object* CallStubCompiler::CompileCallField(JSObject* object, | 988 Object* CallStubCompiler::CompileCallField(JSObject* object, |
| 986 JSObject* holder, | 989 JSObject* holder, |
| 987 int index, | 990 int index, |
| 988 String* name) { | 991 String* name) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 if (object->IsGlobalObject()) { | 1025 if (object->IsGlobalObject()) { |
| 1023 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1026 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 1024 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1027 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 1025 } | 1028 } |
| 1026 | 1029 |
| 1027 // Invoke the function. | 1030 // Invoke the function. |
| 1028 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 1031 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
| 1029 | 1032 |
| 1030 // Handle call cache miss. | 1033 // Handle call cache miss. |
| 1031 __ bind(&miss); | 1034 __ bind(&miss); |
| 1032 GenerateMissBranch(); | 1035 Object* obj = GenerateMissBranch(); |
| 1036 if (obj->IsFailure()) return obj; |
| 1033 | 1037 |
| 1034 // Return the generated code. | 1038 // Return the generated code. |
| 1035 return GetCode(FIELD, name); | 1039 return GetCode(FIELD, name); |
| 1036 } | 1040 } |
| 1037 | 1041 |
| 1038 | 1042 |
| 1039 Object* CallStubCompiler::CompileArrayPushCall(Object* object, | 1043 Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
| 1040 JSObject* holder, | 1044 JSObject* holder, |
| 1041 JSFunction* function, | 1045 JSFunction* function, |
| 1042 String* name, | 1046 String* name, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 | 1183 |
| 1180 __ bind(&call_builtin); | 1184 __ bind(&call_builtin); |
| 1181 } | 1185 } |
| 1182 | 1186 |
| 1183 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1187 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
| 1184 argc + 1, | 1188 argc + 1, |
| 1185 1); | 1189 1); |
| 1186 } | 1190 } |
| 1187 | 1191 |
| 1188 __ bind(&miss); | 1192 __ bind(&miss); |
| 1189 | 1193 Object* obj = GenerateMissBranch(); |
| 1190 GenerateMissBranch(); | 1194 if (obj->IsFailure()) return obj; |
| 1191 | 1195 |
| 1192 // Return the generated code. | 1196 // Return the generated code. |
| 1193 return GetCode(function); | 1197 return GetCode(function); |
| 1194 } | 1198 } |
| 1195 | 1199 |
| 1196 | 1200 |
| 1197 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1201 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
| 1198 JSObject* holder, | 1202 JSObject* holder, |
| 1199 JSFunction* function, | 1203 JSFunction* function, |
| 1200 String* name, | 1204 String* name, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 __ bind(&return_undefined); | 1267 __ bind(&return_undefined); |
| 1264 | 1268 |
| 1265 __ Move(rax, Factory::undefined_value()); | 1269 __ Move(rax, Factory::undefined_value()); |
| 1266 __ ret((argc + 1) * kPointerSize); | 1270 __ ret((argc + 1) * kPointerSize); |
| 1267 | 1271 |
| 1268 __ bind(&call_builtin); | 1272 __ bind(&call_builtin); |
| 1269 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1273 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
| 1270 argc + 1, | 1274 argc + 1, |
| 1271 1); | 1275 1); |
| 1272 __ bind(&miss); | 1276 __ bind(&miss); |
| 1273 | 1277 Object* obj = GenerateMissBranch(); |
| 1274 GenerateMissBranch(); | 1278 if (obj->IsFailure()) return obj; |
| 1275 | 1279 |
| 1276 // Return the generated code. | 1280 // Return the generated code. |
| 1277 return GetCode(function); | 1281 return GetCode(function); |
| 1278 } | 1282 } |
| 1279 | 1283 |
| 1280 | 1284 |
| 1281 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, | 1285 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, |
| 1282 JSObject* holder, | 1286 JSObject* holder, |
| 1283 JSFunction* function, | 1287 JSFunction* function, |
| 1284 String* name, | 1288 String* name, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1354 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 1351 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1355 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 1352 } | 1356 } |
| 1353 | 1357 |
| 1354 // Invoke the function. | 1358 // Invoke the function. |
| 1355 __ movq(rdi, rax); | 1359 __ movq(rdi, rax); |
| 1356 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 1360 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
| 1357 | 1361 |
| 1358 // Handle load cache miss. | 1362 // Handle load cache miss. |
| 1359 __ bind(&miss); | 1363 __ bind(&miss); |
| 1360 GenerateMissBranch(); | 1364 Object* obj = GenerateMissBranch(); |
| 1365 if (obj->IsFailure()) return obj; |
| 1361 | 1366 |
| 1362 // Return the generated code. | 1367 // Return the generated code. |
| 1363 return GetCode(INTERCEPTOR, name); | 1368 return GetCode(INTERCEPTOR, name); |
| 1364 } | 1369 } |
| 1365 | 1370 |
| 1366 | 1371 |
| 1367 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1372 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, |
| 1368 GlobalObject* holder, | 1373 GlobalObject* holder, |
| 1369 JSGlobalPropertyCell* cell, | 1374 JSGlobalPropertyCell* cell, |
| 1370 JSFunction* function, | 1375 JSFunction* function, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 __ IncrementCounter(&Counters::call_global_inline, 1); | 1440 __ IncrementCounter(&Counters::call_global_inline, 1); |
| 1436 ASSERT(function->is_compiled()); | 1441 ASSERT(function->is_compiled()); |
| 1437 Handle<Code> code(function->code()); | 1442 Handle<Code> code(function->code()); |
| 1438 ParameterCount expected(function->shared()->formal_parameter_count()); | 1443 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 1439 __ InvokeCode(code, expected, arguments(), | 1444 __ InvokeCode(code, expected, arguments(), |
| 1440 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 1445 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 1441 | 1446 |
| 1442 // Handle call cache miss. | 1447 // Handle call cache miss. |
| 1443 __ bind(&miss); | 1448 __ bind(&miss); |
| 1444 __ IncrementCounter(&Counters::call_global_inline_miss, 1); | 1449 __ IncrementCounter(&Counters::call_global_inline_miss, 1); |
| 1445 GenerateMissBranch(); | 1450 Object* obj = GenerateMissBranch(); |
| 1451 if (obj->IsFailure()) return obj; |
| 1446 | 1452 |
| 1447 // Return the generated code. | 1453 // Return the generated code. |
| 1448 return GetCode(NORMAL, name); | 1454 return GetCode(NORMAL, name); |
| 1449 } | 1455 } |
| 1450 | 1456 |
| 1451 | 1457 |
| 1452 Object* LoadStubCompiler::CompileLoadCallback(String* name, | 1458 Object* LoadStubCompiler::CompileLoadCallback(String* name, |
| 1453 JSObject* object, | 1459 JSObject* object, |
| 1454 JSObject* holder, | 1460 JSObject* holder, |
| 1455 AccessorInfo* callback) { | 1461 AccessorInfo* callback) { |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2608 // Return the generated code. | 2614 // Return the generated code. |
| 2609 return GetCode(); | 2615 return GetCode(); |
| 2610 } | 2616 } |
| 2611 | 2617 |
| 2612 | 2618 |
| 2613 #undef __ | 2619 #undef __ |
| 2614 | 2620 |
| 2615 } } // namespace v8::internal | 2621 } } // namespace v8::internal |
| 2616 | 2622 |
| 2617 #endif // V8_TARGET_ARCH_X64 | 2623 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |