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 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 // For integer array types: | 3188 // For integer array types: |
3189 // rcx: value | 3189 // rcx: value |
3190 // For floating-point array type: | 3190 // For floating-point array type: |
3191 // xmm0: value as double. | 3191 // xmm0: value as double. |
3192 | 3192 |
3193 ASSERT(kSmiValueSize == 32); | 3193 ASSERT(kSmiValueSize == 32); |
3194 if (array_type == kExternalUnsignedIntArray) { | 3194 if (array_type == kExternalUnsignedIntArray) { |
3195 // For the UnsignedInt array type, we need to see whether | 3195 // For the UnsignedInt array type, we need to see whether |
3196 // the value can be represented in a Smi. If not, we need to convert | 3196 // the value can be represented in a Smi. If not, we need to convert |
3197 // it to a HeapNumber. | 3197 // it to a HeapNumber. |
3198 NearLabel box_int; | 3198 Label box_int; |
3199 | 3199 |
3200 __ JumpIfUIntNotValidSmiValue(rcx, &box_int); | 3200 __ JumpIfUIntNotValidSmiValue(rcx, &box_int, Label::kNear); |
3201 | 3201 |
3202 __ Integer32ToSmi(rax, rcx); | 3202 __ Integer32ToSmi(rax, rcx); |
3203 __ ret(0); | 3203 __ ret(0); |
3204 | 3204 |
3205 __ bind(&box_int); | 3205 __ bind(&box_int); |
3206 | 3206 |
3207 // Allocate a HeapNumber for the int and perform int-to-double | 3207 // Allocate a HeapNumber for the int and perform int-to-double |
3208 // conversion. | 3208 // conversion. |
3209 // The value is zero-extended since we loaded the value from memory | 3209 // The value is zero-extended since we loaded the value from memory |
3210 // with movl. | 3210 // with movl. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3279 // Unsigned comparison catches both negative and too-large values. | 3279 // Unsigned comparison catches both negative and too-large values. |
3280 __ j(above_equal, &slow); | 3280 __ j(above_equal, &slow); |
3281 | 3281 |
3282 // Handle both smis and HeapNumbers in the fast path. Go to the | 3282 // Handle both smis and HeapNumbers in the fast path. Go to the |
3283 // runtime for all other kinds of values. | 3283 // runtime for all other kinds of values. |
3284 // rax: value | 3284 // rax: value |
3285 // rcx: key (a smi) | 3285 // rcx: key (a smi) |
3286 // rdx: receiver (a JSObject) | 3286 // rdx: receiver (a JSObject) |
3287 // rbx: elements array | 3287 // rbx: elements array |
3288 // rdi: untagged key | 3288 // rdi: untagged key |
3289 NearLabel check_heap_number; | 3289 Label check_heap_number; |
3290 if (array_type == kExternalPixelArray) { | 3290 if (array_type == kExternalPixelArray) { |
3291 // Float to pixel conversion is only implemented in the runtime for now. | 3291 // Float to pixel conversion is only implemented in the runtime for now. |
3292 __ JumpIfNotSmi(rax, &slow); | 3292 __ JumpIfNotSmi(rax, &slow); |
3293 } else { | 3293 } else { |
3294 __ JumpIfNotSmi(rax, &check_heap_number); | 3294 __ JumpIfNotSmi(rax, &check_heap_number, Label::kNear); |
3295 } | 3295 } |
3296 // No more branches to slow case on this path. Key and receiver not needed. | 3296 // No more branches to slow case on this path. Key and receiver not needed. |
3297 __ SmiToInteger32(rdx, rax); | 3297 __ SmiToInteger32(rdx, rax); |
3298 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); | 3298 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); |
3299 // rbx: base pointer of external storage | 3299 // rbx: base pointer of external storage |
3300 switch (array_type) { | 3300 switch (array_type) { |
3301 case kExternalPixelArray: | 3301 case kExternalPixelArray: |
3302 { // Clamp the value to [0..255]. | 3302 { // Clamp the value to [0..255]. |
3303 Label done; | 3303 Label done; |
3304 __ testl(rdx, Immediate(0xFFFFFF00)); | 3304 __ testl(rdx, Immediate(0xFFFFFF00)); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 3424 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
3425 | 3425 |
3426 return GetCode(flags); | 3426 return GetCode(flags); |
3427 } | 3427 } |
3428 | 3428 |
3429 #undef __ | 3429 #undef __ |
3430 | 3430 |
3431 } } // namespace v8::internal | 3431 } } // namespace v8::internal |
3432 | 3432 |
3433 #endif // V8_TARGET_ARCH_X64 | 3433 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |