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 16795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16806 " x++; \n" | 16806 " x++; \n" |
16807 " throw new Error('again'); \n" // This is the new uncaught error. | 16807 " throw new Error('again'); \n" // This is the new uncaught error. |
16808 "} \n"; | 16808 "} \n"; |
16809 CompileRun(throw_again); | 16809 CompileRun(throw_again); |
16810 CHECK(try_catch.HasCaught()); | 16810 CHECK(try_catch.HasCaught()); |
16811 Local<Message> message = try_catch.Message(); | 16811 Local<Message> message = try_catch.Message(); |
16812 CHECK(!message.IsEmpty()); | 16812 CHECK(!message.IsEmpty()); |
16813 CHECK_EQ(6, message->GetLineNumber()); | 16813 CHECK_EQ(6, message->GetLineNumber()); |
16814 } | 16814 } |
16815 } | 16815 } |
| 16816 |
| 16817 |
| 16818 THREADED_TEST(Regress137002a) { |
| 16819 i::FLAG_allow_natives_syntax = true; |
| 16820 v8::HandleScope scope; |
| 16821 LocalContext context; |
| 16822 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 16823 templ->SetAccessor(v8_str("foo"), |
| 16824 GetterWhichReturns42, |
| 16825 SetterWhichSetsYOnThisTo23); |
| 16826 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
| 16827 |
| 16828 // Turn monomorphic on slow object with native accessor, then turn |
| 16829 // polymorphic, finally optimize to create negative lookup and fail. |
| 16830 CompileRun("function f(x) { return x.foo; }" |
| 16831 "%OptimizeObjectForAddingMultipleProperties(obj, 1);" |
| 16832 "obj.__proto__ = null;" |
| 16833 "f(obj); f(obj); f({});" |
| 16834 "%OptimizeFunctionOnNextCall(f);" |
| 16835 "var result = f(obj);"); |
| 16836 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); |
| 16837 } |
| 16838 |
| 16839 |
| 16840 THREADED_TEST(Regress137002b) { |
| 16841 i::FLAG_allow_natives_syntax = true; |
| 16842 v8::HandleScope scope; |
| 16843 LocalContext context; |
| 16844 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 16845 templ->SetAccessor(v8_str("foo"), |
| 16846 GetterWhichReturns42, |
| 16847 SetterWhichSetsYOnThisTo23); |
| 16848 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
| 16849 |
| 16850 // Turn monomorphic on slow object with native accessor, then just |
| 16851 // delete the property and fail. |
| 16852 CompileRun("function f(x) { return x.foo; }" |
| 16853 "%OptimizeObjectForAddingMultipleProperties(obj, 1);" |
| 16854 "obj.__proto__ = null;" |
| 16855 "f(obj); f(obj); delete obj.foo;" |
| 16856 "var result = f(obj);"); |
| 16857 CHECK(context->Global()->Get(v8_str("result"))->IsUndefined()); |
| 16858 } |
OLD | NEW |