| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 9612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9623 LocalContext context; | 9623 LocalContext context; |
| 9624 context->Global()->Set(v8_str("P"), templ->NewInstance()); | 9624 context->Global()->Set(v8_str("P"), templ->NewInstance()); |
| 9625 CompileRun("function C1() {" | 9625 CompileRun("function C1() {" |
| 9626 " this.x = 23;" | 9626 " this.x = 23;" |
| 9627 "};" | 9627 "};" |
| 9628 "C1.prototype = P;" | 9628 "C1.prototype = P;" |
| 9629 "function C2() {" | 9629 "function C2() {" |
| 9630 " this.x = 23" | 9630 " this.x = 23" |
| 9631 "};" | 9631 "};" |
| 9632 "C2.prototype = { };" | 9632 "C2.prototype = { };" |
| 9633 "C2.prototype.__proto__ = P;" | 9633 "C2.prototype.__proto__ = P;"); |
| 9634 "" | |
| 9635 "" | |
| 9636 ""); | |
| 9637 | 9634 |
| 9638 v8::Local<v8::Script> script; | 9635 v8::Local<v8::Script> script; |
| 9639 script = v8::Script::Compile(v8_str("new C1();")); | 9636 script = v8::Script::Compile(v8_str("new C1();")); |
| 9640 for (int i = 0; i < 10; i++) { | 9637 for (int i = 0; i < 10; i++) { |
| 9641 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); | 9638 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); |
| 9642 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value()); | 9639 CHECK_EQ(42, c1->Get(v8_str("x"))->Int32Value()); |
| 9643 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value()); | 9640 CHECK_EQ(23, c1->Get(v8_str("y"))->Int32Value()); |
| 9644 } | 9641 } |
| 9645 | 9642 |
| 9646 script = v8::Script::Compile(v8_str("new C2();")); | 9643 script = v8::Script::Compile(v8_str("new C2();")); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 9675 LocalContext context; | 9672 LocalContext context; |
| 9676 context->Global()->Set(v8_str("P"), templ->NewInstance()); | 9673 context->Global()->Set(v8_str("P"), templ->NewInstance()); |
| 9677 CompileRun("function C1() {" | 9674 CompileRun("function C1() {" |
| 9678 " this.x = 23;" | 9675 " this.x = 23;" |
| 9679 "};" | 9676 "};" |
| 9680 "C1.prototype = P;" | 9677 "C1.prototype = P;" |
| 9681 "function C2() {" | 9678 "function C2() {" |
| 9682 " this.x = 23" | 9679 " this.x = 23" |
| 9683 "};" | 9680 "};" |
| 9684 "C2.prototype = { };" | 9681 "C2.prototype = { };" |
| 9685 "C2.prototype.__proto__ = P;" | 9682 "C2.prototype.__proto__ = P;"); |
| 9686 "" | |
| 9687 "" | |
| 9688 ""); | |
| 9689 | 9683 |
| 9690 v8::Local<v8::Script> script; | 9684 v8::Local<v8::Script> script; |
| 9691 script = v8::Script::Compile(v8_str("new C1();")); | 9685 script = v8::Script::Compile(v8_str("new C1();")); |
| 9692 for (int i = 0; i < 10; i++) { | 9686 for (int i = 0; i < 10; i++) { |
| 9693 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); | 9687 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); |
| 9694 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value()); | 9688 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value()); |
| 9695 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); | 9689 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); |
| 9696 } | 9690 } |
| 9697 | 9691 |
| 9698 script = v8::Script::Compile(v8_str("new C2();")); | 9692 script = v8::Script::Compile(v8_str("new C2();")); |
| 9699 for (int i = 0; i < 10; i++) { | 9693 for (int i = 0; i < 10; i++) { |
| 9700 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run()); | 9694 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run()); |
| 9701 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value()); | 9695 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value()); |
| 9702 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value()); | 9696 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value()); |
| 9703 } | 9697 } |
| 9704 } | 9698 } |
| OLD | NEW |