Diff
Modified: trunk/LayoutTests/ChangeLog (188497 => 188498)
--- trunk/LayoutTests/ChangeLog 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/LayoutTests/ChangeLog 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1,3 +1,15 @@
+2015-08-14 Ryosuke Niwa <[email protected]>
+
+ ES6 class syntax should allow computed name method
+ https://bugs.webkit.org/show_bug.cgi?id=142690
+
+ Reviewed by Saam Barati.
+
+ Added test cases for computed method names.
+
+ * js/class-syntax-method-names-expected.txt:
+ * js/script-tests/class-syntax-method-names.js:
+
2015-08-14 Eric Carlson <[email protected]>
[Mac] video-buffered-range-contains-currentTime.html is flakey after r188390
Modified: trunk/LayoutTests/js/class-syntax-method-names-expected.txt (188497 => 188498)
--- trunk/LayoutTests/js/class-syntax-method-names-expected.txt 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/LayoutTests/js/class-syntax-method-names-expected.txt 2015-08-14 23:50:25 UTC (rev 188498)
@@ -3,6 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+Instance methods
PASS class A { 0.1() { return 1; } }; (new A)[0.1]() is 1
PASS class A { get() { return 2; } }; (new A).get() is 2
PASS class A { set() { return 3; } }; (new A).set() is 3
@@ -10,6 +11,8 @@
PASS class A { get set() { return 5; } }; (new A).set is 5
PASS setterValue = undefined; class A { set get(x) { setterValue = x; } }; (new A).get = 6; setterValue is 6
PASS setterValue = undefined; class A { set set(x) { setterValue = x; } }; (new A).set = 7; setterValue is 7
+
+Static methods
PASS class A { static 0.1() { return 101; } }; A[0.1]() is 101
PASS class A { static get() { return 102; } }; A.get() is 102
PASS class A { static set() { return 103; } }; A.set() is 103
@@ -17,6 +20,66 @@
PASS class A { static get set() { return 105; } }; A.set is 105
PASS setterValue = undefined; class A { static set get(x) { setterValue = x; } }; A.get = 106; setterValue is 106
PASS setterValue = undefined; class A { static set set(x) { setterValue = x; } }; A.set = 107; setterValue is 107
+
+Instance methods with computed names
+PASS class A { ['a' + 'b']() { return 211; } }; (new A).ab() is 211
+PASS class A { ['a' + 0]() { return 212; } }; (new A).a0() is 212
+PASS class A { [0.1]() { return 213; } }; (new A)[0.1]() is 213
+PASS class A { [1]() { return 214; } }; (new A)[1]() is 214
+PASS A = createClassWithInstanceMethod('foo', 215); (new A)['foo']() is 215
+PASS A = createClassWithInstanceMethod('foo', 216); B = createClassWithInstanceMethod('bar', 217); [(new A)['foo'](), (new B)['bar']()] is [216, 217]
+
+Static methods with computed names
+PASS class A { static ['a' + 'b']() { return 311; } }; A.ab() is 311
+PASS class A { static ['a' + 0]() { return 312; } }; A.a0() is 312
+PASS class A { static [0.1]() { return 313; } }; A[0.1]() is 313
+PASS class A { static [1]() { return 314; } }; A[1]() is 314
+PASS A = createClassWithStaticMethod('foo', 315); A['foo']() is 315
+PASS A = createClassWithStaticMethod('foo', 316); B = createClassWithStaticMethod('bar', 317); [A['foo'](), B['bar']()] is [316, 317]
+
+Instance methods with duplicated names
+PASS class A { ab() { return 401 } ab() { return 402; } }; (new A).ab() is 402
+PASS class A { 'a'() { return 403 } 'a'() { return 404; } }; (new A).a() is 404
+PASS class A { 1() { return 405 } 1() { return 406; } }; (new A)[1]() is 406
+PASS class A { 0.1() { return 407 } 0.1() { return 408; } }; (new A)[0.1]() is 408
+PASS class A { ab() { return 409 } ['a' + 'b']() { return 410; } }; (new A).ab() is 410
+PASS class A { ['ab']() { return 411 } ab() { return 412; } }; (new A).ab() is 412
+PASS class A { a() { return 413 } ['a']() { return 414; } a() { return 415; } }; (new A).a() is 415
+PASS class A { ['b']() { return 416 } b() { return 417; } ['b']() { return 418; } }; (new A).b() is 418
+PASS class A { a() { return 419 } get a() { return 420; } }; (new A).a is 420
+PASS class A { get a() { return 421 } a() { return 422 } }; (new A).a() is 422
+PASS setterValue = undefined; class A { a() { return 423 } set a(x) { setterValue = x } }; (new A).a = 424; setterValue is 424
+PASS setterValue = undefined; class A { set a(x) { setterValue = x } a() { return 425 } }; (new A).a() is 425
+PASS setterValue = undefined; class A { get foo() { return 426 } set foo(x) { setterValue = x; } }; a = new A; a.foo = a.foo; setterValue is 426
+PASS class A { get foo() { } foo() { } set foo(x) { } }; valueTypes((new A).__proto__, 'foo') is ['value']
+PASS class A { set foo(x) { } foo() { } get foo() { } }; valueTypes((new A).__proto__, 'foo') is ['value']
+PASS class A { foo() { } get foo() { } set foo(x) { } }; valueTypes((new A).__proto__, 'foo') is ['get', 'set']
+PASS class A { foo() { } set foo(x) { } get foo() { } }; valueTypes((new A).__proto__, 'foo') is ['get', 'set']
+PASS class A { get foo() { } set foo(x) { } foo() { } }; valueTypes((new A).__proto__, 'foo') is ['value']
+PASS class A { set foo(x) { } get foo() { } foo() { } }; valueTypes((new A).__proto__, 'foo') is ['value']
+
+Static methods with duplicated names
+PASS class A { static ab() { return 501 } static ab() { return 502; } }; A.ab() is 502
+PASS class A { static 'a'() { return 503 } static 'a'() { return 504; } }; A.a() is 504
+PASS class A { static 1() { return 505 } static 1() { return 506; } }; A[1]() is 506
+PASS class A { static 0.1() { return 507 } static 0.1() { return 508; } }; A[0.1]() is 508
+PASS class A { static ab() { return 509 } static ['a' + 'b']() { return 510; } }; A.ab() is 510
+PASS class A { static ['ab']() { return 511 } static ab() { return 512; } }; A.ab() is 512
+PASS class A { static a() { return 513 } static ['a']() { return 514; } static a() { return 515; } }; A.a() is 515
+PASS class A { static ['b']() { return 516 } static b() { return 517; } static ['b']() { return 518; } }; A.b() is 518
+PASS class A { static a() { return 519 } static get a() { return 520; } }; A.a is 520
+PASS class A { static get a() { return 521 } static a() { return 522 } }; A.a() is 522
+PASS setterValue = undefined; class A { static a() { return 523 } static set a(x) { setterValue = x } }; A.a = 524; setterValue is 524
+PASS setterValue = undefined; class A { static set a(x) { setterValue = x } static a() { return 525 } }; A.a() is 525
+PASS setterValue = undefined; class A { static get foo() { return 526 } static set foo(x) { setterValue = x; } }; A.foo = A.foo; setterValue is 526
+PASS class A { static get foo() { } static foo() { } static set foo(x) { } }; valueTypes(A, 'foo') is ['value']
+PASS class A { static set foo(x) { } static foo() { } static get foo() { } }; valueTypes(A, 'foo') is ['value']
+PASS class A { static foo() { } static get foo() { } static set foo(x) { } }; valueTypes(A, 'foo') is ['get', 'set']
+PASS class A { static foo() { } static set foo(x) { } static get foo() { } }; valueTypes(A, 'foo') is ['get', 'set']
+PASS class A { static get foo() { } static set foo(x) { } static foo() { } }; valueTypes(A, 'foo') is ['value']
+PASS class A { static set foo(x) { } static get foo() { } static foo() { } }; valueTypes(A, 'foo') is ['value']
+
+Static methods with duplicated names
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/js/script-tests/class-syntax-method-names.js (188497 => 188498)
--- trunk/LayoutTests/js/script-tests/class-syntax-method-names.js 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/LayoutTests/js/script-tests/class-syntax-method-names.js 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1,5 +1,6 @@
description('Tests for various method names');
+debug('Instance methods');
shouldBe("class A { 0.1() { return 1; } }; (new A)[0.1]()", "1");
shouldBe("class A { get() { return 2; } }; (new A).get()", "2");
shouldBe("class A { set() { return 3; } }; (new A).set()", "3");
@@ -8,6 +9,8 @@
shouldBe("setterValue = undefined; class A { set get(x) { setterValue = x; } }; (new A).get = 6; setterValue", "6");
shouldBe("setterValue = undefined; class A { set set(x) { setterValue = x; } }; (new A).set = 7; setterValue", "7");
+debug('');
+debug('Static methods');
shouldBe("class A { static 0.1() { return 101; } }; A[0.1]()", "101");
shouldBe("class A { static get() { return 102; } }; A.get()", "102");
shouldBe("class A { static set() { return 103; } }; A.set()", "103");
@@ -15,3 +18,74 @@
shouldBe("class A { static get set() { return 105; } }; A.set", "105");
shouldBe("setterValue = undefined; class A { static set get(x) { setterValue = x; } }; A.get = 106; setterValue", "106");
shouldBe("setterValue = undefined; class A { static set set(x) { setterValue = x; } }; A.set = 107; setterValue", "107");
+
+debug('');
+debug('Instance methods with computed names');
+shouldBe("class A { ['a' + 'b']() { return 211; } }; (new A).ab()", "211");
+shouldBe("class A { ['a' + 0]() { return 212; } }; (new A).a0()", "212");
+shouldBe("class A { [0.1]() { return 213; } }; (new A)[0.1]()", "213");
+shouldBe("class A { [1]() { return 214; } }; (new A)[1]()", "214");
+function createClassWithInstanceMethod(name, value) { return class { [name]() { return value; } } };
+shouldBe("A = createClassWithInstanceMethod('foo', 215); (new A)['foo']()", "215");
+shouldBe("A = createClassWithInstanceMethod('foo', 216); B = createClassWithInstanceMethod('bar', 217); [(new A)['foo'](), (new B)['bar']()]", "[216, 217]");
+
+debug('');
+debug('Static methods with computed names');
+shouldBe("class A { static ['a' + 'b']() { return 311; } }; A.ab()", "311");
+shouldBe("class A { static ['a' + 0]() { return 312; } }; A.a0()", "312");
+shouldBe("class A { static [0.1]() { return 313; } }; A[0.1]()", "313");
+shouldBe("class A { static [1]() { return 314; } }; A[1]()", "314");
+function createClassWithStaticMethod(name, value) { return class { static [name]() { return value; } } };
+shouldBe("A = createClassWithStaticMethod('foo', 315); A['foo']()", "315");
+shouldBe("A = createClassWithStaticMethod('foo', 316); B = createClassWithStaticMethod('bar', 317); [A['foo'](), B['bar']()]", "[316, 317]");
+
+debug('');
+debug('Instance methods with duplicated names');
+shouldBe("class A { ab() { return 401 } ab() { return 402; } }; (new A).ab()", "402");
+shouldBe("class A { 'a'() { return 403 } 'a'() { return 404; } }; (new A).a()", "404");
+shouldBe("class A { 1() { return 405 } 1() { return 406; } }; (new A)[1]()", "406");
+shouldBe("class A { 0.1() { return 407 } 0.1() { return 408; } }; (new A)[0.1]()", "408");
+shouldBe("class A { ab() { return 409 } ['a' + 'b']() { return 410; } }; (new A).ab()", "410");
+shouldBe("class A { ['ab']() { return 411 } ab() { return 412; } }; (new A).ab()", "412");
+shouldBe("class A { a() { return 413 } ['a']() { return 414; } a() { return 415; } }; (new A).a()", "415");
+shouldBe("class A { ['b']() { return 416 } b() { return 417; } ['b']() { return 418; } }; (new A).b()", "418");
+shouldBe("class A { a() { return 419 } get a() { return 420; } }; (new A).a", "420");
+shouldBe("class A { get a() { return 421 } a() { return 422 } }; (new A).a()", "422");
+shouldBe("setterValue = undefined; class A { a() { return 423 } set a(x) { setterValue = x } }; (new A).a = 424; setterValue", "424");
+shouldBe("setterValue = undefined; class A { set a(x) { setterValue = x } a() { return 425 } }; (new A).a()", "425");
+shouldBe("setterValue = undefined; class A { get foo() { return 426 } set foo(x) { setterValue = x; } }; a = new A; a.foo = a.foo; setterValue", "426");
+function valueTypes(object, proeprtyName) {
+ descriptor = Object.getOwnPropertyDescriptor(object, proeprtyName);
+ return ['value', 'get', 'set'].filter(function (name) { return name in descriptor; });
+}
+shouldBe("class A { get foo() { } foo() { } set foo(x) { } }; valueTypes((new A).__proto__, 'foo')", "['value']");
+shouldBe("class A { set foo(x) { } foo() { } get foo() { } }; valueTypes((new A).__proto__, 'foo')", "['value']");
+shouldBe("class A { foo() { } get foo() { } set foo(x) { } }; valueTypes((new A).__proto__, 'foo')", "['get', 'set']");
+shouldBe("class A { foo() { } set foo(x) { } get foo() { } }; valueTypes((new A).__proto__, 'foo')", "['get', 'set']");
+shouldBe("class A { get foo() { } set foo(x) { } foo() { } }; valueTypes((new A).__proto__, 'foo')", "['value']");
+shouldBe("class A { set foo(x) { } get foo() { } foo() { } }; valueTypes((new A).__proto__, 'foo')", "['value']");
+
+debug('');
+debug('Static methods with duplicated names');
+shouldBe("class A { static ab() { return 501 } static ab() { return 502; } }; A.ab()", "502");
+shouldBe("class A { static 'a'() { return 503 } static 'a'() { return 504; } }; A.a()", "504");
+shouldBe("class A { static 1() { return 505 } static 1() { return 506; } }; A[1]()", "506");
+shouldBe("class A { static 0.1() { return 507 } static 0.1() { return 508; } }; A[0.1]()", "508");
+shouldBe("class A { static ab() { return 509 } static ['a' + 'b']() { return 510; } }; A.ab()", "510");
+shouldBe("class A { static ['ab']() { return 511 } static ab() { return 512; } }; A.ab()", "512");
+shouldBe("class A { static a() { return 513 } static ['a']() { return 514; } static a() { return 515; } }; A.a()", "515");
+shouldBe("class A { static ['b']() { return 516 } static b() { return 517; } static ['b']() { return 518; } }; A.b()", "518");
+shouldBe("class A { static a() { return 519 } static get a() { return 520; } }; A.a", "520");
+shouldBe("class A { static get a() { return 521 } static a() { return 522 } }; A.a()", "522");
+shouldBe("setterValue = undefined; class A { static a() { return 523 } static set a(x) { setterValue = x } }; A.a = 524; setterValue", "524");
+shouldBe("setterValue = undefined; class A { static set a(x) { setterValue = x } static a() { return 525 } }; A.a()", "525");
+shouldBe("setterValue = undefined; class A { static get foo() { return 526 } static set foo(x) { setterValue = x; } }; A.foo = A.foo; setterValue", "526");
+shouldBe("class A { static get foo() { } static foo() { } static set foo(x) { } }; valueTypes(A, 'foo')", "['value']");
+shouldBe("class A { static set foo(x) { } static foo() { } static get foo() { } }; valueTypes(A, 'foo')", "['value']");
+shouldBe("class A { static foo() { } static get foo() { } static set foo(x) { } }; valueTypes(A, 'foo')", "['get', 'set']");
+shouldBe("class A { static foo() { } static set foo(x) { } static get foo() { } }; valueTypes(A, 'foo')", "['get', 'set']");
+shouldBe("class A { static get foo() { } static set foo(x) { } static foo() { } }; valueTypes(A, 'foo')", "['value']");
+shouldBe("class A { static set foo(x) { } static get foo() { } static foo() { } }; valueTypes(A, 'foo')", "['value']");
+
+debug('');
+debug('Static methods with duplicated names');
Modified: trunk/Source/_javascript_Core/ChangeLog (188497 => 188498)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1,3 +1,70 @@
+2015-08-14 Ryosuke Niwa <[email protected]>
+
+ ES6 class syntax should allow computed name method
+ https://bugs.webkit.org/show_bug.cgi?id=142690
+
+ Reviewed by Saam Barati.
+
+ Added a new "attributes" attribute to op_put_getter_by_id, op_put_setter_by_id, op_put_getter_setter to specify
+ the property descriptor options so that we can use use op_put_setter_by_id and op_put_getter_setter to define
+ getters and setters for classes. Without this, getters and setters could erroneously override methods.
+
+ * bytecode/BytecodeList.json:
+ * bytecode/BytecodeUseDef.h:
+ (JSC::computeUsesForBytecodeOffset):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpBytecode):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitDirectPutById):
+ (JSC::BytecodeGenerator::emitPutGetterById):
+ (JSC::BytecodeGenerator::emitPutSetterById):
+ (JSC::BytecodeGenerator::emitPutGetterSetter):
+ * bytecompiler/BytecodeGenerator.h:
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::PropertyListNode::emitBytecode): Always use emitPutGetterSetter to emit getters and setters for classes
+ as done for object literals.
+ (JSC::PropertyListNode::emitPutConstantProperty):
+ (JSC::ClassExprNode::emitBytecode):
+ * jit/CCallHelpers.h:
+ (JSC::CCallHelpers::setupArgumentsWithExecState):
+ * jit/JIT.h:
+ * jit/JITInlines.h:
+ (JSC::JIT::callOperation):
+ * jit/JITOperations.cpp:
+ * jit/JITOperations.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_put_getter_by_id):
+ (JSC::JIT::emit_op_put_setter_by_id):
+ (JSC::JIT::emit_op_put_getter_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_put_getter_by_id):
+ (JSC::JIT::emit_op_put_setter_by_id):
+ (JSC::JIT::emit_op_put_getter_setter):
+ (JSC::JIT::emit_op_del_by_id):
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * llint/LowLevelInterpreter.asm:
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createProperty):
+ (JSC::ASTBuilder::createPropertyList):
+ * parser/NodeConstructors.h:
+ (JSC::PropertyNode::PropertyNode):
+ * parser/Nodes.h:
+ (JSC::PropertyNode::expressionName):
+ (JSC::PropertyNode::name):
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseClass): Added the support for computed property name. We don't support computed names
+ for getters and setters.
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::createProperty):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::allowsAccessFrom):
+ (JSC::JSObject::putGetter):
+ (JSC::JSObject::putSetter):
+ * runtime/JSObject.h:
+ * runtime/PropertyDescriptor.h:
+
2015-08-13 Yusuke Suzuki <[email protected]>
Add InspectorInstrumentation builtin object to instrument the code in JS builtins like Promises
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json 2015-08-14 23:50:25 UTC (rev 188498)
@@ -71,9 +71,9 @@
{ "name" : "op_put_by_val_direct", "length" : 5 },
{ "name" : "op_del_by_val", "length" : 4 },
{ "name" : "op_put_by_index", "length" : 4 },
- { "name" : "op_put_getter_by_id", "length" : 4 },
- { "name" : "op_put_setter_by_id", "length" : 4 },
- { "name" : "op_put_getter_setter", "length" : 5 },
+ { "name" : "op_put_getter_by_id", "length" : 5 },
+ { "name" : "op_put_setter_by_id", "length" : 5 },
+ { "name" : "op_put_getter_setter", "length" : 6 },
{ "name" : "op_jmp", "length" : 2 },
{ "name" : "op_jtrue", "length" : 3 },
{ "name" : "op_jfalse", "length" : 3 },
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -98,18 +98,22 @@
case op_put_by_id_transition_normal_out_of_line:
case op_put_by_id_out_of_line:
case op_put_by_id:
- case op_put_getter_by_id:
- case op_put_setter_by_id:
case op_put_to_scope:
case op_put_to_arguments: {
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
+ case op_put_getter_by_id:
+ case op_put_setter_by_id: {
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ return;
+ }
case op_put_getter_setter: {
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
- functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[5].u.operand);
return;
}
case op_get_property_enumerator:
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1082,26 +1082,29 @@
case op_put_getter_by_id: {
int r0 = (++it)->u.operand;
int id0 = (++it)->u.operand;
+ int n0 = (++it)->u.operand;
int r1 = (++it)->u.operand;
printLocationAndOp(out, exec, location, it, "put_getter_by_id");
- out.printf("%s, %s, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data());
+ out.printf("%s, %s, %d, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), n0, registerName(r1).data());
break;
}
case op_put_setter_by_id: {
int r0 = (++it)->u.operand;
int id0 = (++it)->u.operand;
+ int n0 = (++it)->u.operand;
int r1 = (++it)->u.operand;
printLocationAndOp(out, exec, location, it, "put_setter_by_id");
- out.printf("%s, %s, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data());
+ out.printf("%s, %s, %d, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), n0, registerName(r1).data());
break;
}
case op_put_getter_setter: {
int r0 = (++it)->u.operand;
int id0 = (++it)->u.operand;
+ int n0 = (++it)->u.operand;
int r1 = (++it)->u.operand;
int r2 = (++it)->u.operand;
printLocationAndOp(out, exec, location, it, "put_getter_setter");
- out.printf("%s, %s, %s, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data(), registerName(r2).data());
+ out.printf("%s, %s, %d, %s, %s", registerName(r0).data(), idName(id0, identifier(id0)).data(), n0, registerName(r1).data(), registerName(r2).data());
break;
}
case op_del_by_id: {
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1948,7 +1948,7 @@
return value;
}
-void BytecodeGenerator::emitPutGetterById(RegisterID* base, const Identifier& property, RegisterID* getter)
+void BytecodeGenerator::emitPutGetterById(RegisterID* base, const Identifier& property, unsigned attributes, RegisterID* getter)
{
unsigned propertyIndex = addConstant(property);
m_staticPropertyAnalyzer.putById(base->index(), propertyIndex);
@@ -1956,10 +1956,11 @@
emitOpcode(op_put_getter_by_id);
instructions().append(base->index());
instructions().append(propertyIndex);
+ instructions().append(attributes);
instructions().append(getter->index());
}
-void BytecodeGenerator::emitPutSetterById(RegisterID* base, const Identifier& property, RegisterID* setter)
+void BytecodeGenerator::emitPutSetterById(RegisterID* base, const Identifier& property, unsigned attributes, RegisterID* setter)
{
unsigned propertyIndex = addConstant(property);
m_staticPropertyAnalyzer.putById(base->index(), propertyIndex);
@@ -1967,10 +1968,11 @@
emitOpcode(op_put_setter_by_id);
instructions().append(base->index());
instructions().append(propertyIndex);
+ instructions().append(attributes);
instructions().append(setter->index());
}
-void BytecodeGenerator::emitPutGetterSetter(RegisterID* base, const Identifier& property, RegisterID* getter, RegisterID* setter)
+void BytecodeGenerator::emitPutGetterSetter(RegisterID* base, const Identifier& property, unsigned attributes, RegisterID* getter, RegisterID* setter)
{
unsigned propertyIndex = addConstant(property);
@@ -1979,6 +1981,7 @@
emitOpcode(op_put_getter_setter);
instructions().append(base->index());
instructions().append(propertyIndex);
+ instructions().append(attributes);
instructions().append(getter->index());
instructions().append(setter->index());
}
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -508,9 +508,9 @@
RegisterID* emitDeleteByVal(RegisterID* dst, RegisterID* base, RegisterID* property);
RegisterID* emitPutByIndex(RegisterID* base, unsigned index, RegisterID* value);
- void emitPutGetterById(RegisterID* base, const Identifier& property, RegisterID* getter);
- void emitPutSetterById(RegisterID* base, const Identifier& property, RegisterID* setter);
- void emitPutGetterSetter(RegisterID* base, const Identifier& property, RegisterID* getter, RegisterID* setter);
+ void emitPutGetterById(RegisterID* base, const Identifier& property, unsigned propertyDescriptorOptions, RegisterID* getter);
+ void emitPutSetterById(RegisterID* base, const Identifier& property, unsigned propertyDescriptorOptions, RegisterID* setter);
+ void emitPutGetterSetter(RegisterID* base, const Identifier& property, unsigned attributes, RegisterID* getter, RegisterID* setter);
ExpectedFunction expectedFunctionForIdentifier(const Identifier&);
RegisterID* emitCall(RegisterID* dst, RegisterID* func, ExpectedFunction, CallArguments&, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -497,9 +497,9 @@
// This is a get/set property which may be overridden by a computed property later.
if (hasComputedProperty) {
if (node->m_type & PropertyNode::Getter)
- generator.emitPutGetterById(dst, *node->name(), value);
+ generator.emitPutGetterById(dst, *node->name(), Accessor, value);
else
- generator.emitPutSetterById(dst, *node->name(), value);
+ generator.emitPutSetterById(dst, *node->name(), Accessor, value);
continue;
}
@@ -544,12 +544,7 @@
if (isClassProperty && pair.second)
emitPutHomeObject(generator, secondReg, dst);
- if (isClassProperty) {
- RefPtr<RegisterID> propertyNameRegister = generator.emitLoad(generator.newTemporary(), *node->name());
- generator.emitCallDefineProperty(dst, propertyNameRegister.get(),
- nullptr, getterReg.get(), setterReg.get(), BytecodeGenerator::PropertyConfigurable, m_position);
- } else
- generator.emitPutGetterSetter(dst, *node->name(), getterReg.get(), setterReg.get());
+ generator.emitPutGetterSetter(dst, *node->name(), isClassProperty ? (Accessor | DontEnum) : Accessor, getterReg.get(), setterReg.get());
}
}
Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/CCallHelpers.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -302,13 +302,14 @@
addCallArgument(arg3);
}
- ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3)
+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4)
{
resetCallArguments();
addCallArgument(GPRInfo::callFrameRegister);
addCallArgument(arg1);
addCallArgument(arg2);
addCallArgument(arg3);
+ addCallArgument(arg4);
}
ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3)
@@ -1918,6 +1919,14 @@
move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
}
+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5)
+ {
+ setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR4, GPRInfo::argumentGPR5>(arg1, arg4, arg5);
+ move(arg2, GPRInfo::argumentGPR2);
+ move(arg3, GPRInfo::argumentGPR3);
+ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ }
+
ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4)
{
setupStubArguments134(arg1, arg3, arg4);
Modified: trunk/Source/_javascript_Core/jit/JIT.h (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JIT.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -744,8 +744,8 @@
MacroAssembler::Call callOperation(V_JITOperation_E);
MacroAssembler::Call callOperation(V_JITOperation_EC, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_ECC, RegisterID, RegisterID);
- MacroAssembler::Call callOperation(V_JITOperation_ECIC, RegisterID, const Identifier*, RegisterID);
- MacroAssembler::Call callOperation(V_JITOperation_ECICC, RegisterID, const Identifier*, RegisterID, RegisterID);
+ MacroAssembler::Call callOperation(V_JITOperation_ECIZC, RegisterID, const Identifier*, int32_t, RegisterID);
+ MacroAssembler::Call callOperation(V_JITOperation_ECIZCC, RegisterID, const Identifier*, int32_t, RegisterID, RegisterID);
MacroAssembler::Call callOperation(J_JITOperation_EE, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
MacroAssembler::Call callOperation(J_JITOperation_EZSymtabJ, int, SymbolTable*, RegisterID);
@@ -755,8 +755,8 @@
#else
MacroAssembler::Call callOperationNoExceptionCheck(V_JITOperation_EJ, RegisterID, RegisterID);
#endif
- MacroAssembler::Call callOperation(V_JITOperation_EJIdJ, RegisterID, const Identifier*, RegisterID);
- MacroAssembler::Call callOperation(V_JITOperation_EJIdJJ, RegisterID, const Identifier*, RegisterID, RegisterID);
+ MacroAssembler::Call callOperation(V_JITOperation_EJIdZJ, RegisterID, const Identifier*, int32_t, RegisterID);
+ MacroAssembler::Call callOperation(V_JITOperation_EJIdZJJ, RegisterID, const Identifier*, int32_t, RegisterID, RegisterID);
#if USE(JSVALUE64)
MacroAssembler::Call callOperation(F_JITOperation_EFJZZ, RegisterID, RegisterID, int32_t, RegisterID);
MacroAssembler::Call callOperation(V_JITOperation_ESsiJJI, StructureStubInfo*, RegisterID, RegisterID, UniquedStringImpl*);
Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JITInlines.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -514,15 +514,15 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJIdJ operation, RegisterID regOp1, const Identifier* identOp2, RegisterID regOp3)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJIdZJ operation, RegisterID regOp1, const Identifier* identOp2, int32_t op3, RegisterID regOp4)
{
- setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), regOp3);
+ setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4);
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJIdJJ operation, RegisterID regOp1, const Identifier* identOp2, RegisterID regOp3, RegisterID regOp4)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EJIdZJJ operation, RegisterID regOp1, const Identifier* identOp2, int32_t op3, RegisterID regOp4, RegisterID regOp5)
{
- setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), regOp3, regOp4);
+ setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4, regOp5);
return appendCallWithExceptionCheck(operation);
}
@@ -642,15 +642,15 @@
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_ECIC operation, RegisterID regOp1, const Identifier* identOp2, RegisterID regOp3)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_ECIZC operation, RegisterID regOp1, const Identifier* identOp2, int32_t op3, RegisterID regOp4)
{
- setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), regOp3);
+ setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4);
return appendCallWithExceptionCheck(operation);
}
-ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_ECICC operation, RegisterID regOp1, const Identifier* identOp2, RegisterID regOp3, RegisterID regOp4)
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_ECIZCC operation, RegisterID regOp1, const Identifier* identOp2, int32_t op3, RegisterID regOp4, RegisterID regOp5)
{
- setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), regOp3, regOp4);
+ setupArgumentsWithExecState(regOp1, TrustedImmPtr(identOp2), TrustedImm32(op3), regOp4, regOp5);
return appendCallWithExceptionCheck(operation);
}
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1245,7 +1245,7 @@
}
#if USE(JSVALUE64)
-void JIT_OPERATION operationPutGetterById(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, EncodedJSValue encodedGetterValue)
+void JIT_OPERATION operationPutGetterById(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, int32_t options, EncodedJSValue encodedGetterValue)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1255,10 +1255,10 @@
JSValue getter = JSValue::decode(encodedGetterValue);
ASSERT(getter.isObject());
- baseObj->putGetter(exec, *identifier, asObject(getter));
+ baseObj->putGetter(exec, *identifier, asObject(getter), options);
}
-void JIT_OPERATION operationPutSetterById(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, EncodedJSValue encodedSetterValue)
+void JIT_OPERATION operationPutSetterById(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, int32_t options, EncodedJSValue encodedSetterValue)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1268,10 +1268,11 @@
JSValue setter = JSValue::decode(encodedSetterValue);
ASSERT(setter.isObject());
- baseObj->putSetter(exec, *identifier, asObject(setter));
+ baseObj->putSetter(exec, *identifier, asObject(setter), options);
}
-void JIT_OPERATION operationPutGetterSetter(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, EncodedJSValue encodedGetterValue, EncodedJSValue encodedSetterValue)
+void JIT_OPERATION operationPutGetterSetter(ExecState* exec, EncodedJSValue encodedObjectValue, Identifier* identifier, int32_t attribute,
+ EncodedJSValue encodedGetterValue, EncodedJSValue encodedSetterValue)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1291,10 +1292,10 @@
accessor->setGetter(vm, exec->lexicalGlobalObject(), asObject(getter));
if (!setter.isUndefined())
accessor->setSetter(vm, exec->lexicalGlobalObject(), asObject(setter));
- baseObj->putDirectAccessor(exec, *identifier, accessor, Accessor);
+ baseObj->putDirectAccessor(exec, *identifier, accessor, attribute);
}
#else
-void JIT_OPERATION operationPutGetterById(ExecState* exec, JSCell* object, Identifier* identifier, JSCell* getter)
+void JIT_OPERATION operationPutGetterById(ExecState* exec, JSCell* object, Identifier* identifier, int32_t options, JSCell* getter)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1303,10 +1304,10 @@
JSObject* baseObj = object->getObject();
ASSERT(getter->isObject());
- baseObj->putGetter(exec, *identifier, getter);
+ baseObj->putGetter(exec, *identifier, getter, options);
}
-void JIT_OPERATION operationPutSetterById(ExecState* exec, JSCell* object, Identifier* identifier, JSCell* setter)
+void JIT_OPERATION operationPutSetterById(ExecState* exec, JSCell* object, Identifier* identifier, int32_t options, JSCell* setter)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1315,10 +1316,10 @@
JSObject* baseObj = object->getObject();
ASSERT(setter->isObject());
- baseObj->putSetter(exec, *identifier, setter);
+ baseObj->putSetter(exec, *identifier, setter, options);
}
-void JIT_OPERATION operationPutGetterSetter(ExecState* exec, JSCell* object, Identifier* identifier, JSCell* getter, JSCell* setter)
+void JIT_OPERATION operationPutGetterSetter(ExecState* exec, JSCell* object, Identifier* identifier, int32_t attribute, JSCell* getter, JSCell* setter)
{
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
@@ -1336,7 +1337,7 @@
accessor->setGetter(vm, exec->lexicalGlobalObject(), getter->getObject());
if (setter)
accessor->setSetter(vm, exec->lexicalGlobalObject(), setter->getObject());
- baseObj->putDirectAccessor(exec, *identifier, accessor, Accessor);
+ baseObj->putDirectAccessor(exec, *identifier, accessor, attribute);
}
#endif
Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JITOperations.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -183,8 +183,8 @@
typedef void JIT_OPERATION (*V_JITOperation_ECb)(ExecState*, CodeBlock*);
typedef void JIT_OPERATION (*V_JITOperation_ECC)(ExecState*, JSCell*, JSCell*);
typedef void JIT_OPERATION (*V_JITOperation_ECIcf)(ExecState*, JSCell*, InlineCallFrame*);
-typedef void JIT_OPERATION (*V_JITOperation_ECIC)(ExecState*, JSCell*, Identifier*, JSCell*);
-typedef void JIT_OPERATION (*V_JITOperation_ECICC)(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*);
+typedef void JIT_OPERATION (*V_JITOperation_ECIZC)(ExecState*, JSCell*, Identifier*, int32_t, JSCell*);
+typedef void JIT_OPERATION (*V_JITOperation_ECIZCC)(ExecState*, JSCell*, Identifier*, int32_t, JSCell*, JSCell*);
typedef void JIT_OPERATION (*V_JITOperation_ECCIcf)(ExecState*, JSCell*, JSCell*, InlineCallFrame*);
typedef void JIT_OPERATION (*V_JITOperation_ECJJ)(ExecState*, JSCell*, EncodedJSValue, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_ECPSPS)(ExecState*, JSCell*, void*, size_t, void*, size_t);
@@ -193,8 +193,8 @@
typedef void JIT_OPERATION (*V_JITOperation_EZSymtabJ)(ExecState*, int32_t, SymbolTable*, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJ)(ExecState*, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJCI)(ExecState*, EncodedJSValue, JSCell*, UniquedStringImpl*);
-typedef void JIT_OPERATION (*V_JITOperation_EJIdJ)(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue);
-typedef void JIT_OPERATION (*V_JITOperation_EJIdJJ)(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue, EncodedJSValue);
+typedef void JIT_OPERATION (*V_JITOperation_EJIdZJ)(ExecState*, EncodedJSValue, Identifier*, int32_t, EncodedJSValue);
+typedef void JIT_OPERATION (*V_JITOperation_EJIdZJJ)(ExecState*, EncodedJSValue, Identifier*, int32_t, EncodedJSValue, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue);
typedef void JIT_OPERATION (*V_JITOperation_EJJJAp)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue, ArrayProfile*);
typedef void JIT_OPERATION (*V_JITOperation_EJJJBy)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue, ByValInfo*);
@@ -299,13 +299,13 @@
#endif
void JIT_OPERATION operationPutByIndex(ExecState*, EncodedJSValue, int32_t, EncodedJSValue);
#if USE(JSVALUE64)
-void JIT_OPERATION operationPutGetterById(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue) WTF_INTERNAL;
-void JIT_OPERATION operationPutSetterById(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue) WTF_INTERNAL;
-void JIT_OPERATION operationPutGetterSetter(ExecState*, EncodedJSValue, Identifier*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
+void JIT_OPERATION operationPutGetterById(ExecState*, EncodedJSValue, Identifier*, int32_t options, EncodedJSValue) WTF_INTERNAL;
+void JIT_OPERATION operationPutSetterById(ExecState*, EncodedJSValue, Identifier*, int32_t options, EncodedJSValue) WTF_INTERNAL;
+void JIT_OPERATION operationPutGetterSetter(ExecState*, EncodedJSValue, Identifier*, int32_t attribute, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
#else
-void JIT_OPERATION operationPutGetterById(ExecState*, JSCell*, Identifier*, JSCell*) WTF_INTERNAL;
-void JIT_OPERATION operationPutSetterById(ExecState*, JSCell*, Identifier*, JSCell*) WTF_INTERNAL;
-void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, JSCell*, JSCell*) WTF_INTERNAL;
+void JIT_OPERATION operationPutGetterById(ExecState*, JSCell*, Identifier*, int32_t options, JSCell*) WTF_INTERNAL;
+void JIT_OPERATION operationPutSetterById(ExecState*, JSCell*, Identifier*, int32_t options, JSCell*) WTF_INTERNAL;
+void JIT_OPERATION operationPutGetterSetter(ExecState*, JSCell*, Identifier*, int32_t attribute, JSCell*, JSCell*) WTF_INTERNAL;
#endif
void JIT_OPERATION operationPushFunctionNameScope(ExecState*, int32_t, SymbolTable*, EncodedJSValue) WTF_INTERNAL;
void JIT_OPERATION operationPopScope(ExecState*, int32_t) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -483,23 +483,26 @@
void JIT::emit_op_put_getter_by_id(Instruction* currentInstruction)
{
emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT1);
- callOperation(operationPutGetterById, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1);
+ int32_t options = currentInstruction[3].u.operand;
+ emitGetVirtualRegister(currentInstruction[4].u.operand, regT1);
+ callOperation(operationPutGetterById, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), options, regT1);
}
void JIT::emit_op_put_setter_by_id(Instruction* currentInstruction)
{
emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT1);
- callOperation(operationPutSetterById, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1);
+ int32_t options = currentInstruction[3].u.operand;
+ emitGetVirtualRegister(currentInstruction[4].u.operand, regT1);
+ callOperation(operationPutSetterById, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), options, regT1);
}
void JIT::emit_op_put_getter_setter(Instruction* currentInstruction)
{
emitGetVirtualRegister(currentInstruction[1].u.operand, regT0);
- emitGetVirtualRegister(currentInstruction[3].u.operand, regT1);
- emitGetVirtualRegister(currentInstruction[4].u.operand, regT2);
- callOperation(operationPutGetterSetter, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), regT1, regT2);
+ int32_t attribute = currentInstruction[3].u.operand;
+ emitGetVirtualRegister(currentInstruction[4].u.operand, regT1);
+ emitGetVirtualRegister(currentInstruction[5].u.operand, regT2);
+ callOperation(operationPutGetterSetter, regT0, &m_codeBlock->identifier(currentInstruction[2].u.operand), attribute, regT1, regT2);
}
void JIT::emit_op_del_by_id(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -61,35 +61,38 @@
{
int base = currentInstruction[1].u.operand;
int property = currentInstruction[2].u.operand;
- int getter = currentInstruction[3].u.operand;
+ int options = currentInstruction[3].u.operand;
+ int getter = currentInstruction[4].u.operand;
emitLoadPayload(base, regT1);
emitLoadPayload(getter, regT3);
- callOperation(operationPutGetterById, regT1, &m_codeBlock->identifier(property), regT3);
+ callOperation(operationPutGetterById, regT1, &m_codeBlock->identifier(property), options, regT3);
}
void JIT::emit_op_put_setter_by_id(Instruction* currentInstruction)
{
int base = currentInstruction[1].u.operand;
int property = currentInstruction[2].u.operand;
- int setter = currentInstruction[3].u.operand;
+ unsigned options = currentInstruction[3].u.operand;
+ int setter = currentInstruction[4].u.operand;
emitLoadPayload(base, regT1);
emitLoadPayload(setter, regT3);
- callOperation(operationPutSetterById, regT1, &m_codeBlock->identifier(property), regT3);
+ callOperation(operationPutSetterById, regT1, &m_codeBlock->identifier(property), options, regT3);
}
void JIT::emit_op_put_getter_setter(Instruction* currentInstruction)
{
int base = currentInstruction[1].u.operand;
int property = currentInstruction[2].u.operand;
- int getter = currentInstruction[3].u.operand;
- int setter = currentInstruction[4].u.operand;
+ unsigned attribute = currentInstruction[3].u.operand;
+ int getter = currentInstruction[4].u.operand;
+ int setter = currentInstruction[5].u.operand;
emitLoadPayload(base, regT1);
emitLoadPayload(getter, regT3);
emitLoadPayload(setter, regT4);
- callOperation(operationPutGetterSetter, regT1, &m_codeBlock->identifier(property), regT3, regT4);
+ callOperation(operationPutGetterSetter, regT1, &m_codeBlock->identifier(property), attribute, regT3, regT4);
}
void JIT::emit_op_del_by_id(Instruction* currentInstruction)
Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -847,11 +847,13 @@
LLINT_BEGIN();
ASSERT(LLINT_OP(1).jsValue().isObject());
JSObject* baseObj = asObject(LLINT_OP(1).jsValue());
-
- JSValue getter = LLINT_OP(3).jsValue();
+
+ unsigned options = pc[3].u.operand;
+
+ JSValue getter = LLINT_OP(4).jsValue();
ASSERT(getter.isObject());
-
- baseObj->putGetter(exec, exec->codeBlock()->identifier(pc[2].u.operand), asObject(getter));
+
+ baseObj->putGetter(exec, exec->codeBlock()->identifier(pc[2].u.operand), asObject(getter), options);
LLINT_END();
}
@@ -860,11 +862,13 @@
LLINT_BEGIN();
ASSERT(LLINT_OP(1).jsValue().isObject());
JSObject* baseObj = asObject(LLINT_OP(1).jsValue());
-
- JSValue setter = LLINT_OP(3).jsValue();
+
+ unsigned options = pc[3].u.operand;
+
+ JSValue setter = LLINT_OP(4).jsValue();
ASSERT(setter.isObject());
-
- baseObj->putSetter(exec, exec->codeBlock()->identifier(pc[2].u.operand), asObject(setter));
+
+ baseObj->putSetter(exec, exec->codeBlock()->identifier(pc[2].u.operand), asObject(setter), options);
LLINT_END();
}
@@ -876,9 +880,9 @@
GetterSetter* accessor = GetterSetter::create(vm, exec->lexicalGlobalObject());
LLINT_CHECK_EXCEPTION();
-
- JSValue getter = LLINT_OP(3).jsValue();
- JSValue setter = LLINT_OP(4).jsValue();
+
+ JSValue getter = LLINT_OP(4).jsValue();
+ JSValue setter = LLINT_OP(5).jsValue();
ASSERT(getter.isObject() || getter.isUndefined());
ASSERT(setter.isObject() || setter.isUndefined());
ASSERT(getter.isObject() || setter.isObject());
@@ -890,7 +894,7 @@
baseObj->putDirectAccessor(
exec,
exec->codeBlock()->identifier(pc[2].u.operand),
- accessor, Accessor);
+ accessor, pc[3].u.operand);
LLINT_END();
}
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (188497 => 188498)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1062,19 +1062,19 @@
_llint_op_put_getter_by_id:
traceExecution()
callSlowPath(_llint_slow_path_put_getter_by_id)
- dispatch(4)
+ dispatch(5)
_llint_op_put_setter_by_id:
traceExecution()
callSlowPath(_llint_slow_path_put_setter_by_id)
- dispatch(4)
+ dispatch(5)
_llint_op_put_getter_setter:
traceExecution()
callSlowPath(_llint_slow_path_put_getter_setter)
- dispatch(5)
+ dispatch(6)
_llint_op_jtrue:
Modified: trunk/Source/_javascript_Core/parser/ASTBuilder.h (188497 => 188498)
--- trunk/Source/_javascript_Core/parser/ASTBuilder.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/parser/ASTBuilder.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -414,7 +414,7 @@
{
return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType);
}
- PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType); }
+ PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding); }
PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_parserArena) PropertyListNode(location, property); }
PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_parserArena) PropertyListNode(location, property, tail); }
Modified: trunk/Source/_javascript_Core/parser/NodeConstructors.h (188497 => 188498)
--- trunk/Source/_javascript_Core/parser/NodeConstructors.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/parser/NodeConstructors.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -231,12 +231,12 @@
{
}
- inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType)
+ inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding = SuperBinding::NotNeeded)
: m_name(0)
, m_expression(name)
, m_assign(assign)
, m_type(type)
- , m_needsSuperBinding(false)
+ , m_needsSuperBinding(superBinding == SuperBinding::Needed)
, m_putType(putType)
{
}
Modified: trunk/Source/_javascript_Core/parser/Nodes.h (188497 => 188498)
--- trunk/Source/_javascript_Core/parser/Nodes.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/parser/Nodes.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -614,7 +614,7 @@
enum PutType { Unknown, KnownDirect };
PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding);
- PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType);
+ PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding);
ExpressionNode* expressionName() const { return m_expression; }
const Identifier* name() const { return m_name; }
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1961,7 +1961,8 @@
// FIXME: Figure out a way to share more code with parseProperty.
const CommonIdentifiers& propertyNames = *m_vm->propertyNames;
- const Identifier* ident = nullptr;
+ const Identifier* ident = &propertyNames.nullIdentifier;
+ TreeExpression computedPropertyName = 0;
bool isGetter = false;
bool isSetter = false;
switch (m_token.m_type) {
@@ -1985,6 +1986,12 @@
ASSERT(ident);
next();
break;
+ case OPENBRACKET:
+ next();
+ computedPropertyName = parseAssignmentExpression(context);
+ failIfFalse(computedPropertyName, "Cannot parse computed property name");
+ handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name");
+ break;
default:
failDueToUnexpectedToken();
}
@@ -1999,7 +2006,7 @@
ParserFunctionInfo<TreeBuilder> methodInfo;
bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor;
failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
- failIfTrue(!ident || (declareVariable(ident) & DeclarationResult::InvalidStrictMode), "Cannot declare a method named '", methodInfo.name->impl(), "'");
+ failIfTrue(!computedPropertyName && (declareVariable(ident) & DeclarationResult::InvalidStrictMode), "Cannot declare a method named '", methodInfo.name->impl(), "'");
methodInfo.name = isConstructor ? className : ident;
TreeExpression method = context.createFunctionExpr(methodLocation, methodInfo);
@@ -2012,7 +2019,11 @@
// FIXME: Syntax error when super() is called
semanticFailIfTrue(isStaticMethod && methodInfo.name && *methodInfo.name == propertyNames.prototype,
"Cannot declare a static method named 'prototype'");
- property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
+ if (computedPropertyName) {
+ property = context.createProperty(computedPropertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed),
+ PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
+ } else
+ property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
}
TreePropertyList& tail = isStaticMethod ? staticMethodsTail : instanceMethodsTail;
Modified: trunk/Source/_javascript_Core/parser/SyntaxChecker.h (188497 => 188498)
--- trunk/Source/_javascript_Core/parser/SyntaxChecker.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/parser/SyntaxChecker.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -218,7 +218,7 @@
return Property(type);
return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type);
}
- Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool)
+ Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding = SuperBinding::NotNeeded)
{
return Property(type);
}
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (188497 => 188498)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2015-08-14 23:50:25 UTC (rev 188498)
@@ -1198,21 +1198,31 @@
return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec);
}
-void JSObject::putGetter(ExecState* exec, PropertyName propertyName, JSValue getter)
+void JSObject::putGetter(ExecState* exec, PropertyName propertyName, JSValue getter, unsigned attributes)
{
PropertyDescriptor descriptor;
descriptor.setGetter(getter);
- descriptor.setEnumerable(true);
- descriptor.setConfigurable(true);
+
+ ASSERT(attributes & Accessor);
+ if (!(attributes & ReadOnly))
+ descriptor.setConfigurable(true);
+ if (!(attributes & DontEnum))
+ descriptor.setEnumerable(true);
+
defineOwnProperty(this, exec, propertyName, descriptor, false);
}
-void JSObject::putSetter(ExecState* exec, PropertyName propertyName, JSValue setter)
+void JSObject::putSetter(ExecState* exec, PropertyName propertyName, JSValue setter, unsigned attributes)
{
PropertyDescriptor descriptor;
descriptor.setSetter(setter);
- descriptor.setEnumerable(true);
- descriptor.setConfigurable(true);
+
+ ASSERT(attributes & Accessor);
+ if (!(attributes & ReadOnly))
+ descriptor.setConfigurable(true);
+ if (!(attributes & DontEnum))
+ descriptor.setEnumerable(true);
+
defineOwnProperty(this, exec, propertyName, descriptor, false);
}
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (188497 => 188498)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2015-08-14 22:24:26 UTC (rev 188497)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2015-08-14 23:50:25 UTC (rev 188498)
@@ -467,8 +467,8 @@
void putDirectAccessor(ExecState*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE void putDirectCustomAccessor(VM&, PropertyName, JSValue, unsigned attributes);
- void putGetter(ExecState*, PropertyName, JSValue);
- void putSetter(ExecState*, PropertyName, JSValue);
+ void putGetter(ExecState*, PropertyName, JSValue, unsigned attributes);
+ void putSetter(ExecState*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE bool hasProperty(ExecState*, PropertyName) const;
JS_EXPORT_PRIVATE bool hasProperty(ExecState*, unsigned propertyName) const;