| 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 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 // -- eax : argc | 1313 // -- eax : argc |
| 1314 // -- esp[0] : return address | 1314 // -- esp[0] : return address |
| 1315 // -- esp[4] : last argument | 1315 // -- esp[4] : last argument |
| 1316 // ----------------------------------- | 1316 // ----------------------------------- |
| 1317 Label generic_array_code; | 1317 Label generic_array_code; |
| 1318 | 1318 |
| 1319 // Get the InternalArray function. | 1319 // Get the InternalArray function. |
| 1320 __ LoadGlobalFunction(Context::INTERNAL_ARRAY_FUNCTION_INDEX, edi); | 1320 __ LoadGlobalFunction(Context::INTERNAL_ARRAY_FUNCTION_INDEX, edi); |
| 1321 | 1321 |
| 1322 if (FLAG_debug_code) { | 1322 if (FLAG_debug_code) { |
| 1323 // Initial map for the builtin InternalArray function shoud be a map. | 1323 // Initial map for the builtin InternalArray function should be a map. |
| 1324 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 1324 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1325 // Will both indicate a NULL and a Smi. | 1325 // Will both indicate a NULL and a Smi. |
| 1326 __ test(ebx, Immediate(kSmiTagMask)); | 1326 __ test(ebx, Immediate(kSmiTagMask)); |
| 1327 __ Assert(not_zero, "Unexpected initial map for InternalArray function"); | 1327 __ Assert(not_zero, "Unexpected initial map for InternalArray function"); |
| 1328 __ CmpObjectType(ebx, MAP_TYPE, ecx); | 1328 __ CmpObjectType(ebx, MAP_TYPE, ecx); |
| 1329 __ Assert(equal, "Unexpected initial map for InternalArray function"); | 1329 __ Assert(equal, "Unexpected initial map for InternalArray function"); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 // Run the native code for the InternalArray function called as a normal | 1332 // Run the native code for the InternalArray function called as a normal |
| 1333 // function. | 1333 // function. |
| 1334 ArrayNativeCode(masm, false, &generic_array_code); | 1334 ArrayNativeCode(masm, false, &generic_array_code); |
| 1335 | 1335 |
| 1336 // Jump to the generic array code in case the specialized code cannot handle | 1336 // Jump to the generic internal array code in case the specialized code cannot |
| 1337 // the construction. | 1337 // handle the construction. |
| 1338 __ bind(&generic_array_code); | 1338 __ bind(&generic_array_code); |
| 1339 Handle<Code> array_code = | 1339 Handle<Code> array_code = |
| 1340 masm->isolate()->builtins()->InternalArrayCodeGeneric(); | 1340 masm->isolate()->builtins()->InternalArrayCodeGeneric(); |
| 1341 __ jmp(array_code, RelocInfo::CODE_TARGET); | 1341 __ jmp(array_code, RelocInfo::CODE_TARGET); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 | 1344 |
| 1345 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { | 1345 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
| 1346 // ----------- S t a t e ------------- | 1346 // ----------- S t a t e ------------- |
| 1347 // -- eax : argc | 1347 // -- eax : argc |
| 1348 // -- esp[0] : return address | 1348 // -- esp[0] : return address |
| 1349 // -- esp[4] : last argument | 1349 // -- esp[4] : last argument |
| 1350 // ----------------------------------- | 1350 // ----------------------------------- |
| 1351 Label generic_array_code; | 1351 Label generic_array_code; |
| 1352 | 1352 |
| 1353 // Get the Array function. | 1353 // Get the Array function. |
| 1354 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, edi); | 1354 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, edi); |
| 1355 | 1355 |
| 1356 if (FLAG_debug_code) { | 1356 if (FLAG_debug_code) { |
| 1357 // Initial map for the builtin Array function shoud be a map. | 1357 // Initial map for the builtin Array function should be a map. |
| 1358 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 1358 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1359 // Will both indicate a NULL and a Smi. | 1359 // Will both indicate a NULL and a Smi. |
| 1360 __ test(ebx, Immediate(kSmiTagMask)); | 1360 __ test(ebx, Immediate(kSmiTagMask)); |
| 1361 __ Assert(not_zero, "Unexpected initial map for Array function"); | 1361 __ Assert(not_zero, "Unexpected initial map for Array function"); |
| 1362 __ CmpObjectType(ebx, MAP_TYPE, ecx); | 1362 __ CmpObjectType(ebx, MAP_TYPE, ecx); |
| 1363 __ Assert(equal, "Unexpected initial map for Array function"); | 1363 __ Assert(equal, "Unexpected initial map for Array function"); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 // Run the native code for the Array function called as a normal function. | 1366 // Run the native code for the Array function called as a normal function. |
| 1367 ArrayNativeCode(masm, false, &generic_array_code); | 1367 ArrayNativeCode(masm, false, &generic_array_code); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1723 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1724 generator.Generate(); | 1724 generator.Generate(); |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 | 1727 |
| 1728 #undef __ | 1728 #undef __ |
| 1729 } | 1729 } |
| 1730 } // namespace v8::internal | 1730 } // namespace v8::internal |
| 1731 | 1731 |
| 1732 #endif // V8_TARGET_ARCH_IA32 | 1732 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |