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