summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/v8/src/mips/code-stubs-mips.cc
diff options
context:
space:
mode:
authorpalfia@homejinni.com <palfia@homejinni.com>2013-03-08 00:42:59 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-13 15:01:18 +0200
commit1f67245ad2d19ffd85280a2dd066f3b905dc6b2c (patch)
tree9716ddfce035fe44872ff992fea85d7307a1d005 /src/3rdparty/v8/src/mips/code-stubs-mips.cc
parentc8162bccb0123c709b5620a5429fe4b1c275df51 (diff)
[V8] MIPS: ES6 symbols: Implement Symbol intrinsic and basic functionality
Port r13786 (b5e7a82a) Original commit message: - Add --harmony-symbols flag. - Add Symbol constructor; allow symbols as (unreplaced) return value from constructors. - Introduce %CreateSymbol and %_IsSymbol natives and respective instructions. - Extend 'typeof' code generation to handle symbols. - Extend CompareIC with a UNIQUE_NAMES state that (uniformly) handles internalized strings and symbols. - Property lookup delegates to SymbolDelegate object for symbols, which only carries the toString method. - Extend Object.prototype.toString to recognise symbols. Per the current draft spec, symbols are actually pseudo objects that are frozen with a null prototype and only one property (toString). For simplicity, we do not treat them as proper objects for now, although typeof will return "object". Only property access works as if they were (frozen) objects (via the internal delegate object). (Baseline CL: https://codereview.chromium.org/12223071/) BUG= Review URL: https://codereview.chromium.org/12447009 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@13871 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 Change-Id: I5fc2d443b2609ed8832b9bbd0225daf6d882a608 Signed-off-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/3rdparty/v8/src/mips/code-stubs-mips.cc')
-rw-r--r--src/3rdparty/v8/src/mips/code-stubs-mips.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/mips/code-stubs-mips.cc b/src/3rdparty/v8/src/mips/code-stubs-mips.cc
index df00263..618072d 100644
--- a/src/3rdparty/v8/src/mips/code-stubs-mips.cc
+++ b/src/3rdparty/v8/src/mips/code-stubs-mips.cc
@@ -7319,6 +7319,60 @@ void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
}
+void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
+ ASSERT(state_ == CompareIC::UNIQUE_NAME);
+ ASSERT(GetCondition() == eq);
+ Label miss;
+
+ // Registers containing left and right operands respectively.
+ Register left = a1;
+ Register right = a0;
+ Register tmp1 = a2;
+ Register tmp2 = a3;
+
+ // Check that both operands are heap objects.
+ __ JumpIfEitherSmi(left, right, &miss);
+
+ // Check that both operands are unique names. This leaves the instance
+ // types loaded in tmp1 and tmp2.
+ STATIC_ASSERT(kInternalizedTag != 0);
+ __ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset));
+ __ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset));
+ __ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset));
+ __ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset));
+
+ Label succeed1;
+ __ And(at, tmp1, Operand(kIsInternalizedMask));
+ __ Branch(&succeed1, ne, at, Operand(zero_reg));
+ __ Branch(&miss, ne, tmp1, Operand(SYMBOL_TYPE));
+ __ bind(&succeed1);
+
+ Label succeed2;
+ __ And(at, tmp2, Operand(kIsInternalizedMask));
+ __ Branch(&succeed2, ne, at, Operand(zero_reg));
+ __ Branch(&miss, ne, tmp2, Operand(SYMBOL_TYPE));
+ __ bind(&succeed2);
+
+ // Use a0 as result
+ __ mov(v0, a0);
+
+ // Unique names are compared by identity.
+ Label done;
+ __ Branch(&done, ne, left, Operand(right));
+ // Make sure a0 is non-zero. At this point input operands are
+ // guaranteed to be non-zero.
+ ASSERT(right.is(a0));
+ STATIC_ASSERT(EQUAL == 0);
+ STATIC_ASSERT(kSmiTag == 0);
+ __ li(v0, Operand(Smi::FromInt(EQUAL)));
+ __ bind(&done);
+ __ Ret();
+
+ __ bind(&miss);
+ GenerateMiss(masm);
+}
+
+
void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
ASSERT(state_ == CompareIC::STRING);
Label miss;