Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index 5127ddf30cd21f35839beb909c34e878af6871de..25f4bd37301b6dd12fd777216f0991bd02f47e57 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -3206,6 +3206,39 @@ void MacroAssembler::TaggedToI(Register result_reg, |
} |
+void MacroAssembler::Throw(BailoutReason reason) { |
+#ifdef DEBUG |
+ const char* msg = GetBailoutReason(reason); |
+ if (msg != NULL) { |
+ RecordComment("Throw message: "); |
+ RecordComment(msg); |
+ } |
+#endif |
+ |
+ push(rax); |
+ Push(Smi::FromInt(reason)); |
+ if (!has_frame_) { |
+ // We don't actually want to generate a pile of code for this, so just |
+ // claim there is a stack frame, without generating one. |
+ FrameScope scope(this, StackFrame::NONE); |
+ CallRuntime(Runtime::kThrowMessage, 1); |
+ } else { |
+ CallRuntime(Runtime::kThrowMessage, 1); |
+ } |
+ // Control will not return here. |
+ int3(); |
+} |
+ |
+ |
+void MacroAssembler::ThrowIf(Condition cc, BailoutReason reason) { |
+ Label L; |
+ j(NegateCondition(cc), &L); |
+ Throw(reason); |
+ // will not return here |
+ bind(&L); |
+} |
+ |
+ |
void MacroAssembler::LoadInstanceDescriptors(Register map, |
Register descriptors) { |
movq(descriptors, FieldOperand(map, Map::kDescriptorsOffset)); |
@@ -4631,6 +4664,39 @@ int MacroAssembler::ArgumentStackSlotsForCFunctionCall(int num_arguments) { |
} |
+void MacroAssembler::EmitSeqStringSetCharCheck(Register string, |
+ Register index, |
+ Register value, |
+ uint32_t encoding_mask) { |
+ Label is_object; |
+ JumpIfNotSmi(string, &is_object); |
+ Throw(kNonObject); |
+ bind(&is_object); |
+ |
+ push(value); |
+ movq(value, FieldOperand(string, HeapObject::kMapOffset)); |
+ movzxbq(value, FieldOperand(value, Map::kInstanceTypeOffset)); |
+ |
+ andb(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
+ cmpq(value, Immediate(encoding_mask)); |
+ pop(value); |
+ ThrowIf(not_equal, kUnexpectedStringType); |
+ |
+ // The index is assumed to be untagged coming in, tag it to compare with the |
+ // string length without using a temp register, it is restored at the end of |
+ // this function. |
+ Integer32ToSmi(index, index); |
+ SmiCompare(index, FieldOperand(string, String::kLengthOffset)); |
+ ThrowIf(greater_equal, kIndexIsTooLarge); |
+ |
+ SmiCompare(index, Smi::FromInt(0)); |
+ ThrowIf(less, kIndexIsNegative); |
+ |
+ // Restore the index |
+ SmiToInteger32(index, index); |
+} |
+ |
+ |
void MacroAssembler::PrepareCallCFunction(int num_arguments) { |
int frame_alignment = OS::ActivationFrameAlignment(); |
ASSERT(frame_alignment != 0); |