| OLD | NEW |
| 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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 // -- rax : argc | 1242 // -- rax : argc |
| 1243 // -- rsp[0] : return address | 1243 // -- rsp[0] : return address |
| 1244 // -- rsp[8] : last argument | 1244 // -- rsp[8] : last argument |
| 1245 // ----------------------------------- | 1245 // ----------------------------------- |
| 1246 Label generic_array_code; | 1246 Label generic_array_code; |
| 1247 | 1247 |
| 1248 // Get the Array function. | 1248 // Get the Array function. |
| 1249 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rdi); | 1249 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rdi); |
| 1250 | 1250 |
| 1251 if (FLAG_debug_code) { | 1251 if (FLAG_debug_code) { |
| 1252 // Initial map for the builtin Array function shoud be a map. | 1252 // Initial map for the builtin Array functions should be maps. |
| 1253 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 1253 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1254 // Will both indicate a NULL and a Smi. | 1254 // Will both indicate a NULL and a Smi. |
| 1255 ASSERT(kSmiTag == 0); | 1255 ASSERT(kSmiTag == 0); |
| 1256 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); | 1256 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); |
| 1257 __ Check(not_smi, "Unexpected initial map for Array function"); | 1257 __ Check(not_smi, "Unexpected initial map for Array function"); |
| 1258 __ CmpObjectType(rbx, MAP_TYPE, rcx); | 1258 __ CmpObjectType(rbx, MAP_TYPE, rcx); |
| 1259 __ Check(equal, "Unexpected initial map for Array function"); | 1259 __ Check(equal, "Unexpected initial map for Array function"); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 // Run the native code for the Array function called as a normal function. | 1262 // Run the native code for the Array function called as a normal function. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1275 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 1275 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { |
| 1276 // ----------- S t a t e ------------- | 1276 // ----------- S t a t e ------------- |
| 1277 // -- rax : argc | 1277 // -- rax : argc |
| 1278 // -- rdi : constructor | 1278 // -- rdi : constructor |
| 1279 // -- rsp[0] : return address | 1279 // -- rsp[0] : return address |
| 1280 // -- rsp[8] : last argument | 1280 // -- rsp[8] : last argument |
| 1281 // ----------------------------------- | 1281 // ----------------------------------- |
| 1282 Label generic_constructor; | 1282 Label generic_constructor; |
| 1283 | 1283 |
| 1284 if (FLAG_debug_code) { | 1284 if (FLAG_debug_code) { |
| 1285 // The array construct code is only set for the builtin Array function which | 1285 // The array construct code is only set for the builtin and internal |
| 1286 // does always have a map. | 1286 // Array functions which always have a map. |
| 1287 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rbx); | |
| 1288 __ cmpq(rdi, rbx); | |
| 1289 __ Check(equal, "Unexpected Array function"); | |
| 1290 // Initial map for the builtin Array function should be a map. | 1287 // Initial map for the builtin Array function should be a map. |
| 1291 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 1288 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1292 // Will both indicate a NULL and a Smi. | 1289 // Will both indicate a NULL and a Smi. |
| 1293 ASSERT(kSmiTag == 0); | 1290 ASSERT(kSmiTag == 0); |
| 1294 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); | 1291 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); |
| 1295 __ Check(not_smi, "Unexpected initial map for Array function"); | 1292 __ Check(not_smi, "Unexpected initial map for Array function"); |
| 1296 __ CmpObjectType(rbx, MAP_TYPE, rcx); | 1293 __ CmpObjectType(rbx, MAP_TYPE, rcx); |
| 1297 __ Check(equal, "Unexpected initial map for Array function"); | 1294 __ Check(equal, "Unexpected initial map for Array function"); |
| 1298 } | 1295 } |
| 1299 | 1296 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1483 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1487 generator.Generate(); | 1484 generator.Generate(); |
| 1488 } | 1485 } |
| 1489 | 1486 |
| 1490 | 1487 |
| 1491 #undef __ | 1488 #undef __ |
| 1492 | 1489 |
| 1493 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
| 1494 | 1491 |
| 1495 #endif // V8_TARGET_ARCH_X64 | 1492 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |