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