Commit 4d99cef8 authored by lrn@chromium.org's avatar lrn@chromium.org

X64: Templating Smi-macros to use both Label and NearLabel.

Added some more uses of NearLabel.

Review URL: http://codereview.chromium.org/3381005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 83d6c199
...@@ -3343,7 +3343,7 @@ void StringAddStub::Generate(MacroAssembler* masm) { ...@@ -3343,7 +3343,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// Look at the length of the result of adding the two strings. // Look at the length of the result of adding the two strings.
STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue / 2); STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue / 2);
__ SmiAdd(rbx, rbx, rcx, NULL); __ SmiAdd(rbx, rbx, rcx);
// Use the runtime system when adding two one character strings, as it // Use the runtime system when adding two one character strings, as it
// contains optimizations for this specific case using the symbol table. // contains optimizations for this specific case using the symbol table.
__ SmiCompare(rbx, Smi::FromInt(2)); __ SmiCompare(rbx, Smi::FromInt(2));
...@@ -3803,7 +3803,7 @@ void SubStringStub::Generate(MacroAssembler* masm) { ...@@ -3803,7 +3803,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ movq(rdx, Operand(rsp, kFromOffset)); __ movq(rdx, Operand(rsp, kFromOffset));
__ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime); __ JumpIfNotBothPositiveSmi(rcx, rdx, &runtime);
__ SmiSub(rcx, rcx, rdx, NULL); // Overflow doesn't happen. __ SmiSub(rcx, rcx, rdx); // Overflow doesn't happen.
__ cmpq(FieldOperand(rax, String::kLengthOffset), rcx); __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx);
Label return_rax; Label return_rax;
__ j(equal, &return_rax); __ j(equal, &return_rax);
...@@ -3936,8 +3936,7 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, ...@@ -3936,8 +3936,7 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
__ movq(scratch4, scratch1); __ movq(scratch4, scratch1);
__ SmiSub(scratch4, __ SmiSub(scratch4,
scratch4, scratch4,
FieldOperand(right, String::kLengthOffset), FieldOperand(right, String::kLengthOffset));
NULL);
// Register scratch4 now holds left.length - right.length. // Register scratch4 now holds left.length - right.length.
const Register length_difference = scratch4; const Register length_difference = scratch4;
NearLabel left_shorter; NearLabel left_shorter;
...@@ -3945,7 +3944,7 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, ...@@ -3945,7 +3944,7 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
// The right string isn't longer that the left one. // The right string isn't longer that the left one.
// Get the right string's length by subtracting the (non-negative) difference // Get the right string's length by subtracting the (non-negative) difference
// from the left string's length. // from the left string's length.
__ SmiSub(scratch1, scratch1, length_difference, NULL); __ SmiSub(scratch1, scratch1, length_difference);
__ bind(&left_shorter); __ bind(&left_shorter);
// Register scratch1 now holds Min(left.length, right.length). // Register scratch1 now holds Min(left.length, right.length).
const Register min_length = scratch1; const Register min_length = scratch1;
......
...@@ -847,7 +847,7 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, ...@@ -847,7 +847,7 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
// For the UnsignedInt array type, we need to see whether // For the UnsignedInt array type, we need to see whether
// the value can be represented in a Smi. If not, we need to convert // the value can be represented in a Smi. If not, we need to convert
// it to a HeapNumber. // it to a HeapNumber.
Label box_int; NearLabel box_int;
__ JumpIfUIntNotValidSmiValue(rcx, &box_int); __ JumpIfUIntNotValidSmiValue(rcx, &box_int);
...@@ -1032,7 +1032,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -1032,7 +1032,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// No more bailouts to slow case on this path, so key not needed. // No more bailouts to slow case on this path, so key not needed.
__ SmiToInteger32(rdi, rax); __ SmiToInteger32(rdi, rax);
{ // Clamp the value to [0..255]. { // Clamp the value to [0..255].
Label done; NearLabel done;
__ testl(rdi, Immediate(0xFFFFFF00)); __ testl(rdi, Immediate(0xFFFFFF00));
__ j(zero, &done); __ j(zero, &done);
__ setcc(negative, rdi); // 1 if negative, 0 if positive. __ setcc(negative, rdi); // 1 if negative, 0 if positive.
...@@ -1082,7 +1082,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { ...@@ -1082,7 +1082,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// rax: value // rax: value
// rbx: receiver's elements array (a FixedArray) // rbx: receiver's elements array (a FixedArray)
// rcx: index // rcx: index
Label non_smi_value; NearLabel non_smi_value;
__ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize), __ movq(FieldOperand(rbx, rcx, times_pointer_size, FixedArray::kHeaderSize),
rax); rax);
__ JumpIfNotSmi(rax, &non_smi_value); __ JumpIfNotSmi(rax, &non_smi_value);
...@@ -1104,7 +1104,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, ...@@ -1104,7 +1104,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
// -- rdx : receiver // -- rdx : receiver
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
Label slow, check_heap_number; Label slow;
// Check that the object isn't a smi. // Check that the object isn't a smi.
__ JumpIfSmi(rdx, &slow); __ JumpIfSmi(rdx, &slow);
...@@ -1145,6 +1145,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm, ...@@ -1145,6 +1145,7 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
// rdx: receiver (a JSObject) // rdx: receiver (a JSObject)
// rbx: elements array // rbx: elements array
// rdi: untagged key // rdi: untagged key
NearLabel check_heap_number;
__ JumpIfNotSmi(rax, &check_heap_number); __ JumpIfNotSmi(rax, &check_heap_number);
// No more branches to slow case on this path. Key and receiver not needed. // No more branches to slow case on this path. Key and receiver not needed.
__ SmiToInteger32(rdx, rax); __ SmiToInteger32(rdx, rax);
...@@ -1488,7 +1489,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { ...@@ -1488,7 +1489,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
// Get the receiver of the function from the stack; 1 ~ return address. // Get the receiver of the function from the stack; 1 ~ return address.
__ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
Label do_call, slow_call, slow_load, slow_reload_receiver; Label do_call, slow_call, slow_load;
Label check_number_dictionary, check_string, lookup_monomorphic_cache; Label check_number_dictionary, check_string, lookup_monomorphic_cache;
Label index_smi, index_string; Label index_smi, index_string;
...@@ -1880,7 +1881,7 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) { ...@@ -1880,7 +1881,7 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
Label miss, restore_miss; Label miss;
GenerateStringDictionaryReceiverCheck(masm, rdx, rbx, rdi, &miss); GenerateStringDictionaryReceiverCheck(masm, rdx, rbx, rdi, &miss);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment