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