| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index a2f9818733f492596afb9ae4757c8f88dd6d8884..719bcc200e2e5feedac054cae9ec703fe7362b8b 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -2247,11 +2247,14 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
|
| Label slow;
|
| __ JumpIfNotSmi(rdx, &slow);
|
|
|
| - // Check if the calling frame is an arguments adaptor frame.
|
| + // Check if the calling frame is an arguments adaptor frame. We look at the
|
| + // context offset, and if the frame is not a regular one, then we find a
|
| + // Smi instead of the context. We can't use SmiCompare here, because that
|
| + // only works for comparing two smis.
|
| Label adaptor;
|
| __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
|
| - __ SmiCompare(Operand(rbx, StandardFrameConstants::kContextOffset),
|
| - Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| + __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset),
|
| + Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| __ j(equal, &adaptor);
|
|
|
| // Check index against formal parameters count limit passed in
|
| @@ -2306,8 +2309,8 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
|
| // Check if the calling frame is an arguments adaptor frame.
|
| Label adaptor_frame, try_allocate, runtime;
|
| __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
|
| - __ SmiCompare(Operand(rdx, StandardFrameConstants::kContextOffset),
|
| - Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| + __ Cmp(Operand(rdx, StandardFrameConstants::kContextOffset),
|
| + Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| __ j(equal, &adaptor_frame);
|
|
|
| // Get the length from the frame.
|
| @@ -4175,8 +4178,8 @@ void StringAddStub::Generate(MacroAssembler* masm) {
|
| // Look at the length of the result of adding the two strings.
|
| STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue / 2);
|
| __ SmiAdd(rbx, rbx, rcx);
|
| - // Use the runtime system when adding two one character strings, as it
|
| - // contains optimizations for this specific case using the symbol table.
|
| + // Use the symbol table when adding two one character strings, as it
|
| + // helps later optimizations to return a symbol here.
|
| __ SmiCompare(rbx, Smi::FromInt(2));
|
| __ j(not_equal, &longer_than_two);
|
|
|
| @@ -4528,15 +4531,14 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
|
| FieldOperand(symbol_table, SymbolTable::kCapacityOffset));
|
| __ decl(mask);
|
|
|
| - Register undefined = scratch4;
|
| - __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex);
|
| + Register map = scratch4;
|
|
|
| // Registers
|
| // chars: two character string, char 1 in byte 0 and char 2 in byte 1.
|
| // hash: hash of two character string (32-bit int)
|
| // symbol_table: symbol table
|
| // mask: capacity mask (32-bit int)
|
| - // undefined: undefined value
|
| + // map: -
|
| // scratch: -
|
|
|
| // Perform a number of probes in the symbol table.
|
| @@ -4551,7 +4553,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
|
| }
|
| __ andl(scratch, mask);
|
|
|
| - // Load the entry from the symble table.
|
| + // Load the entry from the symbol table.
|
| Register candidate = scratch; // Scratch register contains candidate.
|
| STATIC_ASSERT(SymbolTable::kEntrySize == 1);
|
| __ movq(candidate,
|
| @@ -4561,8 +4563,16 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
|
| SymbolTable::kElementsStartOffset));
|
|
|
| // If entry is undefined no string with this hash can be found.
|
| - __ cmpq(candidate, undefined);
|
| + NearLabel is_string;
|
| + __ CmpObjectType(candidate, ODDBALL_TYPE, map);
|
| + __ j(not_equal, &is_string);
|
| +
|
| + __ CompareRoot(candidate, Heap::kUndefinedValueRootIndex);
|
| __ j(equal, not_found);
|
| + // Must be null (deleted entry).
|
| + __ jmp(&next_probe[i]);
|
| +
|
| + __ bind(&is_string);
|
|
|
| // If length is not 2 the string is not a candidate.
|
| __ SmiCompare(FieldOperand(candidate, String::kLengthOffset),
|
| @@ -4574,8 +4584,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
|
| Register temp = kScratchRegister;
|
|
|
| // Check that the candidate is a non-external ascii string.
|
| - __ movq(temp, FieldOperand(candidate, HeapObject::kMapOffset));
|
| - __ movzxbl(temp, FieldOperand(temp, Map::kInstanceTypeOffset));
|
| + __ movzxbl(temp, FieldOperand(map, Map::kInstanceTypeOffset));
|
| __ JumpIfInstanceTypeIsNotSequentialAscii(
|
| temp, temp, &next_probe[i]);
|
|
|
| @@ -4927,60 +4936,6 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| -void StringCharAtStub::Generate(MacroAssembler* masm) {
|
| - // Expects two arguments (object, index) on the stack:
|
| -
|
| - // Stack frame on entry.
|
| - // rsp[0]: return address
|
| - // rsp[8]: index
|
| - // rsp[16]: object
|
| -
|
| - Register object = rbx;
|
| - Register index = rax;
|
| - Register scratch1 = rcx;
|
| - Register scratch2 = rdx;
|
| - Register result = rax;
|
| -
|
| - __ pop(scratch1); // Return address.
|
| - __ pop(index);
|
| - __ pop(object);
|
| - __ push(scratch1);
|
| -
|
| - Label need_conversion;
|
| - Label index_out_of_range;
|
| - Label done;
|
| - StringCharAtGenerator generator(object,
|
| - index,
|
| - scratch1,
|
| - scratch2,
|
| - result,
|
| - &need_conversion,
|
| - &need_conversion,
|
| - &index_out_of_range,
|
| - STRING_INDEX_IS_NUMBER);
|
| - generator.GenerateFast(masm);
|
| - __ jmp(&done);
|
| -
|
| - __ bind(&index_out_of_range);
|
| - // When the index is out of range, the spec requires us to return
|
| - // the empty string.
|
| - __ LoadRoot(result, Heap::kEmptyStringRootIndex);
|
| - __ jmp(&done);
|
| -
|
| - __ bind(&need_conversion);
|
| - // Move smi zero into the result register, which will trigger
|
| - // conversion.
|
| - __ Move(result, Smi::FromInt(0));
|
| - __ jmp(&done);
|
| -
|
| - StubRuntimeCallHelper call_helper;
|
| - generator.GenerateSlow(masm, call_helper);
|
| -
|
| - __ bind(&done);
|
| - __ ret(0);
|
| -}
|
| -
|
| -
|
| void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
|
| ASSERT(state_ == CompareIC::SMIS);
|
| NearLabel miss;
|
|
|