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