OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 InterceptorStoreICSetter); | 5001 InterceptorStoreICSetter); |
5002 LocalContext context; | 5002 LocalContext context; |
5003 context->Global()->Set(v8_str("o"), templ->NewInstance()); | 5003 context->Global()->Set(v8_str("o"), templ->NewInstance()); |
5004 v8::Handle<Value> value = CompileRun( | 5004 v8::Handle<Value> value = CompileRun( |
5005 "for (var i = 0; i < 1000; i++) {" | 5005 "for (var i = 0; i < 1000; i++) {" |
5006 " o.x = 42;" | 5006 " o.x = 42;" |
5007 "}"); | 5007 "}"); |
5008 } | 5008 } |
5009 | 5009 |
5010 | 5010 |
| 5011 THREADED_TEST(InterceptorStoreICWithNoSetter) { |
| 5012 v8::HandleScope scope; |
| 5013 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); |
| 5014 templ->SetNamedPropertyHandler(InterceptorLoadXICGetter); |
| 5015 LocalContext context; |
| 5016 context->Global()->Set(v8_str("o"), templ->NewInstance()); |
| 5017 v8::Handle<Value> value = CompileRun( |
| 5018 "for (var i = 0; i < 1000; i++) {" |
| 5019 " o.y = 239;" |
| 5020 "}" |
| 5021 "42 + o.y"); |
| 5022 CHECK_EQ(239 + 42, value->Int32Value()); |
| 5023 } |
| 5024 |
| 5025 |
| 5026 |
5011 | 5027 |
5012 v8::Handle<Value> call_ic_function; | 5028 v8::Handle<Value> call_ic_function; |
5013 v8::Handle<Value> call_ic_function2; | 5029 v8::Handle<Value> call_ic_function2; |
5014 v8::Handle<Value> call_ic_function3; | 5030 v8::Handle<Value> call_ic_function3; |
5015 | 5031 |
5016 static v8::Handle<Value> InterceptorCallICGetter(Local<String> name, | 5032 static v8::Handle<Value> InterceptorCallICGetter(Local<String> name, |
5017 const AccessorInfo& info) { | 5033 const AccessorInfo& info) { |
5018 ApiTestFuzzer::Fuzz(); | 5034 ApiTestFuzzer::Fuzz(); |
5019 CHECK(v8_str("x")->Equals(name)); | 5035 CHECK(v8_str("x")->Equals(name)); |
5020 return call_ic_function; | 5036 return call_ic_function; |
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6880 calling_context2->Exit(); | 6896 calling_context2->Exit(); |
6881 | 6897 |
6882 // Dispose the contexts to allow them to be garbage collected. | 6898 // Dispose the contexts to allow them to be garbage collected. |
6883 calling_context0.Dispose(); | 6899 calling_context0.Dispose(); |
6884 calling_context1.Dispose(); | 6900 calling_context1.Dispose(); |
6885 calling_context2.Dispose(); | 6901 calling_context2.Dispose(); |
6886 calling_context0.Clear(); | 6902 calling_context0.Clear(); |
6887 calling_context1.Clear(); | 6903 calling_context1.Clear(); |
6888 calling_context2.Clear(); | 6904 calling_context2.Clear(); |
6889 } | 6905 } |
OLD | NEW |