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 3312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 // other stack fields, and clear the direction flag in anticipation | 3323 // other stack fields, and clear the direction flag in anticipation |
3324 // of calling CopyBytes. | 3324 // of calling CopyBytes. |
3325 __ subq(rsp, Immediate(2 * kPointerSize)); | 3325 __ subq(rsp, Immediate(2 * kPointerSize)); |
3326 __ cld(); | 3326 __ cld(); |
3327 // Check that the array is a JSArray | 3327 // Check that the array is a JSArray |
3328 __ JumpIfSmi(array, &bailout); | 3328 __ JumpIfSmi(array, &bailout); |
3329 __ CmpObjectType(array, JS_ARRAY_TYPE, scratch); | 3329 __ CmpObjectType(array, JS_ARRAY_TYPE, scratch); |
3330 __ j(not_equal, &bailout); | 3330 __ j(not_equal, &bailout); |
3331 | 3331 |
3332 // Check that the array has fast elements. | 3332 // Check that the array has fast elements. |
3333 __ testb(FieldOperand(scratch, Map::kBitField2Offset), | 3333 __ CheckFastElements(scratch, &bailout); |
3334 Immediate(1 << Map::kHasFastElements)); | |
3335 __ j(zero, &bailout); | |
3336 | 3334 |
3337 // Array has fast elements, so its length must be a smi. | 3335 // Array has fast elements, so its length must be a smi. |
3338 // If the array has length zero, return the empty string. | 3336 // If the array has length zero, return the empty string. |
3339 __ movq(array_length, FieldOperand(array, JSArray::kLengthOffset)); | 3337 __ movq(array_length, FieldOperand(array, JSArray::kLengthOffset)); |
3340 __ SmiCompare(array_length, Smi::FromInt(0)); | 3338 __ SmiCompare(array_length, Smi::FromInt(0)); |
3341 __ j(not_zero, &non_trivial_array); | 3339 __ j(not_zero, &non_trivial_array); |
3342 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); | 3340 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); |
3343 __ jmp(&return_result); | 3341 __ jmp(&return_result); |
3344 | 3342 |
3345 // Save the array length on the stack. | 3343 // Save the array length on the stack. |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4309 __ ret(0); | 4307 __ ret(0); |
4310 } | 4308 } |
4311 | 4309 |
4312 | 4310 |
4313 #undef __ | 4311 #undef __ |
4314 | 4312 |
4315 | 4313 |
4316 } } // namespace v8::internal | 4314 } } // namespace v8::internal |
4317 | 4315 |
4318 #endif // V8_TARGET_ARCH_X64 | 4316 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |