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