OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3058 FrameScope scope(this, StackFrame::NONE); | 3058 FrameScope scope(this, StackFrame::NONE); |
3059 CallRuntime(Runtime::kAbort, 2); | 3059 CallRuntime(Runtime::kAbort, 2); |
3060 } else { | 3060 } else { |
3061 CallRuntime(Runtime::kAbort, 2); | 3061 CallRuntime(Runtime::kAbort, 2); |
3062 } | 3062 } |
3063 // will not return here | 3063 // will not return here |
3064 int3(); | 3064 int3(); |
3065 } | 3065 } |
3066 | 3066 |
3067 | 3067 |
| 3068 void MacroAssembler::Throw(BailoutReason reason) { |
| 3069 #ifdef DEBUG |
| 3070 const char* msg = GetBailoutReason(reason); |
| 3071 if (msg != NULL) { |
| 3072 RecordComment("Throw message: "); |
| 3073 RecordComment(msg); |
| 3074 } |
| 3075 #endif |
| 3076 |
| 3077 push(eax); |
| 3078 push(Immediate(Smi::FromInt(reason))); |
| 3079 // Disable stub call restrictions to always allow calls to throw. |
| 3080 if (!has_frame_) { |
| 3081 // We don't actually want to generate a pile of code for this, so just |
| 3082 // claim there is a stack frame, without generating one. |
| 3083 FrameScope scope(this, StackFrame::NONE); |
| 3084 CallRuntime(Runtime::kThrowMessage, 1); |
| 3085 } else { |
| 3086 CallRuntime(Runtime::kThrowMessage, 1); |
| 3087 } |
| 3088 // will not return here |
| 3089 int3(); |
| 3090 } |
| 3091 |
| 3092 |
| 3093 void MacroAssembler::ThrowIf(Condition cc, BailoutReason reason) { |
| 3094 Label L; |
| 3095 j(NegateCondition(cc), &L); |
| 3096 Throw(reason); |
| 3097 // will not return here |
| 3098 bind(&L); |
| 3099 } |
| 3100 |
| 3101 |
3068 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3102 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3069 Register descriptors) { | 3103 Register descriptors) { |
3070 mov(descriptors, FieldOperand(map, Map::kDescriptorsOffset)); | 3104 mov(descriptors, FieldOperand(map, Map::kDescriptorsOffset)); |
3071 } | 3105 } |
3072 | 3106 |
3073 | 3107 |
3074 void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) { | 3108 void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) { |
3075 mov(dst, FieldOperand(map, Map::kBitField3Offset)); | 3109 mov(dst, FieldOperand(map, Map::kBitField3Offset)); |
3076 DecodeField<Map::NumberOfOwnDescriptorsBits>(dst); | 3110 DecodeField<Map::NumberOfOwnDescriptorsBits>(dst); |
3077 } | 3111 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3223 Label succeed; | 3257 Label succeed; |
3224 test(operand, Immediate(kIsNotStringMask | kIsNotInternalizedMask)); | 3258 test(operand, Immediate(kIsNotStringMask | kIsNotInternalizedMask)); |
3225 j(zero, &succeed); | 3259 j(zero, &succeed); |
3226 cmpb(operand, static_cast<uint8_t>(SYMBOL_TYPE)); | 3260 cmpb(operand, static_cast<uint8_t>(SYMBOL_TYPE)); |
3227 j(not_equal, not_unique_name, distance); | 3261 j(not_equal, not_unique_name, distance); |
3228 | 3262 |
3229 bind(&succeed); | 3263 bind(&succeed); |
3230 } | 3264 } |
3231 | 3265 |
3232 | 3266 |
| 3267 void MacroAssembler::EmitSeqStringSetCharCheck(Register string, |
| 3268 Register index, |
| 3269 Register value, |
| 3270 uint32_t encoding_mask) { |
| 3271 Label is_object; |
| 3272 JumpIfNotSmi(string, &is_object, Label::kNear); |
| 3273 Throw(kNonObject); |
| 3274 bind(&is_object); |
| 3275 |
| 3276 push(value); |
| 3277 mov(value, FieldOperand(string, HeapObject::kMapOffset)); |
| 3278 movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset)); |
| 3279 |
| 3280 and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
| 3281 cmp(value, Immediate(encoding_mask)); |
| 3282 pop(value); |
| 3283 ThrowIf(not_equal, kUnexpectedStringType); |
| 3284 |
| 3285 // The index is assumed to be untagged coming in, tag it to compare with the |
| 3286 // string length without using a temp register, it is restored at the end of |
| 3287 // this function. |
| 3288 SmiTag(index); |
| 3289 // Can't use overflow here directly, compiler can't seem to disambiguate. |
| 3290 ThrowIf(NegateCondition(no_overflow), kIndexIsTooLarge); |
| 3291 |
| 3292 cmp(index, FieldOperand(string, String::kLengthOffset)); |
| 3293 ThrowIf(greater_equal, kIndexIsTooLarge); |
| 3294 |
| 3295 cmp(index, Immediate(Smi::FromInt(0))); |
| 3296 ThrowIf(less, kIndexIsNegative); |
| 3297 |
| 3298 // Restore the index |
| 3299 SmiUntag(index); |
| 3300 } |
| 3301 |
| 3302 |
3233 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { | 3303 void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { |
3234 int frame_alignment = OS::ActivationFrameAlignment(); | 3304 int frame_alignment = OS::ActivationFrameAlignment(); |
3235 if (frame_alignment != 0) { | 3305 if (frame_alignment != 0) { |
3236 // Make stack end at alignment and make room for num_arguments words | 3306 // Make stack end at alignment and make room for num_arguments words |
3237 // and the original value of esp. | 3307 // and the original value of esp. |
3238 mov(scratch, esp); | 3308 mov(scratch, esp); |
3239 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); | 3309 sub(esp, Immediate((num_arguments + 1) * kPointerSize)); |
3240 ASSERT(IsPowerOf2(frame_alignment)); | 3310 ASSERT(IsPowerOf2(frame_alignment)); |
3241 and_(esp, -frame_alignment); | 3311 and_(esp, -frame_alignment); |
3242 mov(Operand(esp, num_arguments * kPointerSize), scratch); | 3312 mov(Operand(esp, num_arguments * kPointerSize), scratch); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3685 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3616 j(equal, found); | 3686 j(equal, found); |
3617 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3687 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3618 cmp(current, Immediate(factory->null_value())); | 3688 cmp(current, Immediate(factory->null_value())); |
3619 j(not_equal, &loop_again); | 3689 j(not_equal, &loop_again); |
3620 } | 3690 } |
3621 | 3691 |
3622 } } // namespace v8::internal | 3692 } } // namespace v8::internal |
3623 | 3693 |
3624 #endif // V8_TARGET_ARCH_IA32 | 3694 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |