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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 template<class Info> | 170 template<class Info> |
171 static void XSetter(Local<Value> value, const Info& info, int offset) { | 171 static void XSetter(Local<Value> value, const Info& info, int offset) { |
172 v8::Isolate* isolate = CcTest::isolate(); | 172 v8::Isolate* isolate = CcTest::isolate(); |
173 CHECK_EQ(isolate, info.GetIsolate()); | 173 CHECK_EQ(isolate, info.GetIsolate()); |
174 CHECK_EQ(x_holder, info.This()); | 174 CHECK_EQ(x_holder, info.This()); |
175 CHECK_EQ(x_holder, info.Holder()); | 175 CHECK_EQ(x_holder, info.Holder()); |
176 x_register[offset] = value->Int32Value(); | 176 x_register[offset] = value->Int32Value(); |
| 177 info.GetReturnValue().Set(v8_num(-1)); |
177 } | 178 } |
178 | 179 |
179 | 180 |
180 static void XSetter(Local<String> name, | 181 static void XSetter(Local<String> name, |
181 Local<Value> value, | 182 Local<Value> value, |
182 const v8::PropertyCallbackInfo<void>& info) { | 183 const v8::PropertyCallbackInfo<void>& info) { |
183 XSetter(value, info, 0); | 184 XSetter(value, info, 0); |
184 } | 185 } |
185 | 186 |
186 | 187 |
(...skipping 16 matching lines...) Expand all Loading... |
203 context->Global()->Set(v8_str("holder"), x_holder); | 204 context->Global()->Set(v8_str("holder"), x_holder); |
204 x_receiver = v8::Object::New(isolate); | 205 x_receiver = v8::Object::New(isolate); |
205 context->Global()->Set(v8_str("obj"), x_receiver); | 206 context->Global()->Set(v8_str("obj"), x_receiver); |
206 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun( | 207 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun( |
207 "obj.__proto__ = holder;" | 208 "obj.__proto__ = holder;" |
208 "var result = [];" | 209 "var result = [];" |
209 "var key_0 = 'x0';" | 210 "var key_0 = 'x0';" |
210 "var key_1 = 'x1';" | 211 "var key_1 = 'x1';" |
211 "for (var j = 0; j < 10; j++) {" | 212 "for (var j = 0; j < 10; j++) {" |
212 " var i = 4*j;" | 213 " var i = 4*j;" |
213 " holder.x0 = i;" | 214 " result.push(holder.x0 = i);" |
214 " result.push(obj.x0);" | 215 " result.push(obj.x0);" |
215 " holder.x1 = i + 1;" | 216 " result.push(holder.x1 = i + 1);" |
216 " result.push(obj.x1);" | 217 " result.push(obj.x1);" |
217 " holder[key_0] = i + 2;" | 218 " result.push(holder[key_0] = i + 2);" |
218 " result.push(obj[key_0]);" | 219 " result.push(obj[key_0]);" |
219 " holder[key_1] = i + 3;" | 220 " result.push(holder[key_1] = i + 3);" |
220 " result.push(obj[key_1]);" | 221 " result.push(obj[key_1]);" |
221 "}" | 222 "}" |
222 "result")); | 223 "result")); |
223 CHECK_EQ(40, array->Length()); | 224 CHECK_EQ(80, array->Length()); |
224 for (int i = 0; i < 40; i++) { | 225 for (int i = 0; i < 80; i++) { |
225 v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i)); | 226 v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i)); |
226 CHECK_EQ(v8::Integer::New(isolate, i), entry); | 227 CHECK_EQ(v8::Integer::New(isolate, i/2), entry); |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 | 231 |
231 static void AccessorProhibitsOverwritingGetter( | 232 static void AccessorProhibitsOverwritingGetter( |
232 Local<String> name, | 233 Local<String> name, |
233 const v8::PropertyCallbackInfo<v8::Value>& info) { | 234 const v8::PropertyCallbackInfo<v8::Value>& info) { |
234 ApiTestFuzzer::Fuzz(); | 235 ApiTestFuzzer::Fuzz(); |
235 info.GetReturnValue().Set(true); | 236 info.GetReturnValue().Set(true); |
236 } | 237 } |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 "Object.defineProperty(this.__proto__, 'x', {" | 618 "Object.defineProperty(this.__proto__, 'x', {" |
618 " get : function() { return this; }," | 619 " get : function() { return this; }," |
619 " set : function() { set_value = this; }" | 620 " set : function() { set_value = this; }" |
620 "});" | 621 "});" |
621 "function getter() { return x; }" | 622 "function getter() { return x; }" |
622 "function setter() { x = 1; }" | 623 "function setter() { x = 1; }" |
623 "for (var i = 0; i < 4; i++) { getter(); setter(); }"); | 624 "for (var i = 0; i < 4; i++) { getter(); setter(); }"); |
624 CHECK(v8::Utils::OpenHandle(*CompileRun("getter()"))->IsJSGlobalProxy()); | 625 CHECK(v8::Utils::OpenHandle(*CompileRun("getter()"))->IsJSGlobalProxy()); |
625 CHECK(v8::Utils::OpenHandle(*CompileRun("set_value"))->IsJSGlobalProxy()); | 626 CHECK(v8::Utils::OpenHandle(*CompileRun("set_value"))->IsJSGlobalProxy()); |
626 } | 627 } |
OLD | NEW |