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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 __ movq(kScratchRegister, debug_step_in_fp); | 132 __ movq(kScratchRegister, debug_step_in_fp); |
133 __ cmpq(Operand(kScratchRegister, 0), Immediate(0)); | 133 __ cmpq(Operand(kScratchRegister, 0), Immediate(0)); |
134 __ j(not_equal, &rt_call); | 134 __ j(not_equal, &rt_call); |
135 #endif | 135 #endif |
136 | 136 |
137 // Verified that the constructor is a JSFunction. | 137 // Verified that the constructor is a JSFunction. |
138 // Load the initial map and verify that it is in fact a map. | 138 // Load the initial map and verify that it is in fact a map. |
139 // rdi: constructor | 139 // rdi: constructor |
140 __ movq(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 140 __ movq(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
141 // Will both indicate a NULL and a Smi | 141 // Will both indicate a NULL and a Smi |
142 ASSERT(kSmiTag == 0); | 142 STATIC_ASSERT(kSmiTag == 0); |
143 __ JumpIfSmi(rax, &rt_call); | 143 __ JumpIfSmi(rax, &rt_call); |
144 // rdi: constructor | 144 // rdi: constructor |
145 // rax: initial map (if proven valid below) | 145 // rax: initial map (if proven valid below) |
146 __ CmpObjectType(rax, MAP_TYPE, rbx); | 146 __ CmpObjectType(rax, MAP_TYPE, rbx); |
147 __ j(not_equal, &rt_call); | 147 __ j(not_equal, &rt_call); |
148 | 148 |
149 // Check that the constructor is not constructing a JSFunction (see comments | 149 // Check that the constructor is not constructing a JSFunction (see comments |
150 // in Runtime_NewObject in runtime.cc). In which case the initial map's | 150 // in Runtime_NewObject in runtime.cc). In which case the initial map's |
151 // instance type would be JS_FUNCTION_TYPE. | 151 // instance type would be JS_FUNCTION_TYPE. |
152 // rdi: constructor | 152 // rdi: constructor |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 // ----------------------------------- | 1276 // ----------------------------------- |
1277 Label generic_array_code; | 1277 Label generic_array_code; |
1278 | 1278 |
1279 // Get the Array function. | 1279 // Get the Array function. |
1280 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rdi); | 1280 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rdi); |
1281 | 1281 |
1282 if (FLAG_debug_code) { | 1282 if (FLAG_debug_code) { |
1283 // Initial map for the builtin Array functions should be maps. | 1283 // Initial map for the builtin Array functions should be maps. |
1284 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 1284 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
1285 // Will both indicate a NULL and a Smi. | 1285 // Will both indicate a NULL and a Smi. |
1286 ASSERT(kSmiTag == 0); | 1286 STATIC_ASSERT(kSmiTag == 0); |
1287 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); | 1287 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); |
1288 __ Check(not_smi, "Unexpected initial map for Array function"); | 1288 __ Check(not_smi, "Unexpected initial map for Array function"); |
1289 __ CmpObjectType(rbx, MAP_TYPE, rcx); | 1289 __ CmpObjectType(rbx, MAP_TYPE, rcx); |
1290 __ Check(equal, "Unexpected initial map for Array function"); | 1290 __ Check(equal, "Unexpected initial map for Array function"); |
1291 } | 1291 } |
1292 | 1292 |
1293 // Run the native code for the Array function called as a normal function. | 1293 // Run the native code for the Array function called as a normal function. |
1294 ArrayNativeCode(masm, &generic_array_code); | 1294 ArrayNativeCode(masm, &generic_array_code); |
1295 | 1295 |
1296 // Jump to the generic array code in case the specialized code cannot handle | 1296 // Jump to the generic array code in case the specialized code cannot handle |
(...skipping 13 matching lines...) Expand all Loading... |
1310 // -- rsp[8] : last argument | 1310 // -- rsp[8] : last argument |
1311 // ----------------------------------- | 1311 // ----------------------------------- |
1312 Label generic_constructor; | 1312 Label generic_constructor; |
1313 | 1313 |
1314 if (FLAG_debug_code) { | 1314 if (FLAG_debug_code) { |
1315 // The array construct code is only set for the builtin and internal | 1315 // The array construct code is only set for the builtin and internal |
1316 // Array functions which always have a map. | 1316 // Array functions which always have a map. |
1317 // Initial map for the builtin Array function should be a map. | 1317 // Initial map for the builtin Array function should be a map. |
1318 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 1318 __ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
1319 // Will both indicate a NULL and a Smi. | 1319 // Will both indicate a NULL and a Smi. |
1320 ASSERT(kSmiTag == 0); | 1320 STATIC_ASSERT(kSmiTag == 0); |
1321 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); | 1321 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); |
1322 __ Check(not_smi, "Unexpected initial map for Array function"); | 1322 __ Check(not_smi, "Unexpected initial map for Array function"); |
1323 __ CmpObjectType(rbx, MAP_TYPE, rcx); | 1323 __ CmpObjectType(rbx, MAP_TYPE, rcx); |
1324 __ Check(equal, "Unexpected initial map for Array function"); | 1324 __ Check(equal, "Unexpected initial map for Array function"); |
1325 } | 1325 } |
1326 | 1326 |
1327 // Run the native code for the Array function called as constructor. | 1327 // Run the native code for the Array function called as constructor. |
1328 ArrayNativeCode(masm, &generic_constructor); | 1328 ArrayNativeCode(masm, &generic_constructor); |
1329 | 1329 |
1330 // Jump to the generic construct code in case the specialized code cannot | 1330 // Jump to the generic construct code in case the specialized code cannot |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1514 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1515 generator.Generate(); | 1515 generator.Generate(); |
1516 } | 1516 } |
1517 | 1517 |
1518 | 1518 |
1519 #undef __ | 1519 #undef __ |
1520 | 1520 |
1521 } } // namespace v8::internal | 1521 } } // namespace v8::internal |
1522 | 1522 |
1523 #endif // V8_TARGET_ARCH_X64 | 1523 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |