OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 v8_str("foo"), GetIntValue, SetIntValue, | 147 v8_str("foo"), GetIntValue, SetIntValue, |
148 v8::External::New(isolate, &foo)); | 148 v8::External::New(isolate, &foo)); |
149 templ->InstanceTemplate()->SetAccessor( | 149 templ->InstanceTemplate()->SetAccessor( |
150 v8_str("bar"), GetIntValue, SetIntValue, | 150 v8_str("bar"), GetIntValue, SetIntValue, |
151 v8::External::New(isolate, &bar)); | 151 v8::External::New(isolate, &bar)); |
152 templ->InstanceTemplate()->SetAccessor( | 152 templ->InstanceTemplate()->SetAccessor( |
153 v8_str("baz"), GetIntValue, SetIntValue, | 153 v8_str("baz"), GetIntValue, SetIntValue, |
154 v8::External::New(isolate, &baz)); | 154 v8::External::New(isolate, &baz)); |
155 LocalContext env(0, templ->InstanceTemplate()); | 155 LocalContext env(0, templ->InstanceTemplate()); |
156 v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked(); | 156 v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked(); |
157 CHECK_EQ(bar, -3); | 157 CHECK_EQ(-3, bar); |
158 CHECK_EQ(foo, 7); | 158 CHECK_EQ(7, foo); |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 static int x_register[2] = {0, 0}; | 162 static int x_register[2] = {0, 0}; |
163 static v8::Local<v8::Object> x_receiver; | 163 static v8::Local<v8::Object> x_receiver; |
164 static v8::Local<v8::Object> x_holder; | 164 static v8::Local<v8::Object> x_holder; |
165 | 165 |
166 template<class Info> | 166 template<class Info> |
167 static void XGetter(const Info& info, int offset) { | 167 static void XGetter(const Info& info, int offset) { |
168 ApiTestFuzzer::Fuzz(); | 168 ApiTestFuzzer::Fuzz(); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 ->Set(env.local(), v8_str("Fun"), | 792 ->Set(env.local(), v8_str("Fun"), |
793 fun_templ->GetFunction(env.local()).ToLocalChecked()) | 793 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
794 .FromJust()); | 794 .FromJust()); |
795 | 795 |
796 CompileRun( | 796 CompileRun( |
797 "var f = new Fun();" | 797 "var f = new Fun();" |
798 "Number.prototype.__proto__ = f;" | 798 "Number.prototype.__proto__ = f;" |
799 "var a = 42;" | 799 "var a = 42;" |
800 "for (var i = 0; i<3; i++) { a.foo; }"); | 800 "for (var i = 0; i<3; i++) { a.foo; }"); |
801 } | 801 } |
OLD | NEW |