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 4940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 InterceptorStoreICSetter); | 4951 InterceptorStoreICSetter); |
4952 LocalContext context; | 4952 LocalContext context; |
4953 context->Global()->Set(v8_str("o"), templ->NewInstance()); | 4953 context->Global()->Set(v8_str("o"), templ->NewInstance()); |
4954 v8::Handle<Value> value = CompileRun( | 4954 v8::Handle<Value> value = CompileRun( |
4955 "for (var i = 0; i < 1000; i++) {" | 4955 "for (var i = 0; i < 1000; i++) {" |
4956 " o.x = 42;" | 4956 " o.x = 42;" |
4957 "}"); | 4957 "}"); |
4958 } | 4958 } |
4959 | 4959 |
4960 | 4960 |
| 4961 THREADED_TEST(InterceptorStoreICWithNoSetter) { |
| 4962 v8::HandleScope scope; |
| 4963 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); |
| 4964 templ->SetNamedPropertyHandler(InterceptorLoadXICGetter); |
| 4965 LocalContext context; |
| 4966 context->Global()->Set(v8_str("o"), templ->NewInstance()); |
| 4967 v8::Handle<Value> value = CompileRun( |
| 4968 "for (var i = 0; i < 1000; i++) {" |
| 4969 " o.y = 239;" |
| 4970 "}" |
| 4971 "42 + o.y"); |
| 4972 CHECK_EQ(239 + 42, value->Int32Value()); |
| 4973 } |
| 4974 |
| 4975 |
| 4976 |
4961 | 4977 |
4962 v8::Handle<Value> call_ic_function; | 4978 v8::Handle<Value> call_ic_function; |
4963 v8::Handle<Value> call_ic_function2; | 4979 v8::Handle<Value> call_ic_function2; |
4964 v8::Handle<Value> call_ic_function3; | 4980 v8::Handle<Value> call_ic_function3; |
4965 | 4981 |
4966 static v8::Handle<Value> InterceptorCallICGetter(Local<String> name, | 4982 static v8::Handle<Value> InterceptorCallICGetter(Local<String> name, |
4967 const AccessorInfo& info) { | 4983 const AccessorInfo& info) { |
4968 ApiTestFuzzer::Fuzz(); | 4984 ApiTestFuzzer::Fuzz(); |
4969 CHECK(v8_str("x")->Equals(name)); | 4985 CHECK(v8_str("x")->Equals(name)); |
4970 return call_ic_function; | 4986 return call_ic_function; |
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6762 calling_context2->Exit(); | 6778 calling_context2->Exit(); |
6763 | 6779 |
6764 // Dispose the contexts to allow them to be garbage collected. | 6780 // Dispose the contexts to allow them to be garbage collected. |
6765 calling_context0.Dispose(); | 6781 calling_context0.Dispose(); |
6766 calling_context1.Dispose(); | 6782 calling_context1.Dispose(); |
6767 calling_context2.Dispose(); | 6783 calling_context2.Dispose(); |
6768 calling_context0.Clear(); | 6784 calling_context0.Clear(); |
6769 calling_context1.Clear(); | 6785 calling_context1.Clear(); |
6770 calling_context2.Clear(); | 6786 calling_context2.Clear(); |
6771 } | 6787 } |
OLD | NEW |