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 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2973 test(esp, Immediate(frame_alignment_mask)); | 2973 test(esp, Immediate(frame_alignment_mask)); |
2974 j(zero, &alignment_as_expected); | 2974 j(zero, &alignment_as_expected); |
2975 // Abort if stack is not aligned. | 2975 // Abort if stack is not aligned. |
2976 int3(); | 2976 int3(); |
2977 bind(&alignment_as_expected); | 2977 bind(&alignment_as_expected); |
2978 } | 2978 } |
2979 } | 2979 } |
2980 | 2980 |
2981 | 2981 |
2982 void MacroAssembler::Abort(BailoutReason reason) { | 2982 void MacroAssembler::Abort(BailoutReason reason) { |
2983 // We want to pass the msg string like a smi to avoid GC | 2983 #ifdef DEBUG |
2984 // problems, however msg is not guaranteed to be aligned | |
2985 // properly. Instead, we pass an aligned pointer that is | |
2986 // a proper v8 smi, but also pass the alignment difference | |
2987 // from the real pointer as a smi. | |
2988 const char* msg = GetBailoutReason(reason); | 2984 const char* msg = GetBailoutReason(reason); |
2989 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | |
2990 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | |
2991 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | |
2992 #ifdef DEBUG | |
2993 if (msg != NULL) { | 2985 if (msg != NULL) { |
2994 RecordComment("Abort message: "); | 2986 RecordComment("Abort message: "); |
2995 RecordComment(msg); | 2987 RecordComment(msg); |
2996 } | 2988 } |
2997 | 2989 |
2998 if (FLAG_trap_on_abort) { | 2990 if (FLAG_trap_on_abort) { |
2999 int3(); | 2991 int3(); |
3000 return; | 2992 return; |
3001 } | 2993 } |
3002 #endif | 2994 #endif |
3003 | 2995 |
3004 push(eax); | 2996 push(eax); |
3005 push(Immediate(p0)); | 2997 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(reason)))); |
3006 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); | |
3007 // Disable stub call restrictions to always allow calls to abort. | 2998 // Disable stub call restrictions to always allow calls to abort. |
3008 if (!has_frame_) { | 2999 if (!has_frame_) { |
3009 // We don't actually want to generate a pile of code for this, so just | 3000 // We don't actually want to generate a pile of code for this, so just |
3010 // claim there is a stack frame, without generating one. | 3001 // claim there is a stack frame, without generating one. |
3011 FrameScope scope(this, StackFrame::NONE); | 3002 FrameScope scope(this, StackFrame::NONE); |
3012 CallRuntime(Runtime::kAbort, 2); | 3003 CallRuntime(Runtime::kAbort, 1); |
3013 } else { | 3004 } else { |
3014 CallRuntime(Runtime::kAbort, 2); | 3005 CallRuntime(Runtime::kAbort, 1); |
3015 } | 3006 } |
3016 // will not return here | 3007 // will not return here |
3017 int3(); | 3008 int3(); |
3018 } | 3009 } |
3019 | 3010 |
3020 | 3011 |
3021 void MacroAssembler::Throw(BailoutReason reason) { | 3012 void MacroAssembler::Throw(BailoutReason reason) { |
3022 #ifdef DEBUG | 3013 #ifdef DEBUG |
3023 const char* msg = GetBailoutReason(reason); | 3014 const char* msg = GetBailoutReason(reason); |
3024 if (msg != NULL) { | 3015 if (msg != NULL) { |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3634 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3644 j(equal, found); | 3635 j(equal, found); |
3645 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3636 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3646 cmp(current, Immediate(factory->null_value())); | 3637 cmp(current, Immediate(factory->null_value())); |
3647 j(not_equal, &loop_again); | 3638 j(not_equal, &loop_again); |
3648 } | 3639 } |
3649 | 3640 |
3650 } } // namespace v8::internal | 3641 } } // namespace v8::internal |
3651 | 3642 |
3652 #endif // V8_TARGET_ARCH_IA32 | 3643 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |