| 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 16575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16586 v8::V8::SetFatalErrorHandler(CountingErrorCallback); | 16586 v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
| 16587 v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8"); | 16587 v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8"); |
| 16588 i::Isolate::Current()->TearDown(); | 16588 i::Isolate::Current()->TearDown(); |
| 16589 CHECK(!i::Internals::IsInitialized(isolate)); | 16589 CHECK(!i::Internals::IsInitialized(isolate)); |
| 16590 CHECK_EQ(1, fatal_error_callback_counter); | 16590 CHECK_EQ(1, fatal_error_callback_counter); |
| 16591 CHECK(v8::String::Empty().IsEmpty()); | 16591 CHECK(v8::String::Empty().IsEmpty()); |
| 16592 CHECK_EQ(2, fatal_error_callback_counter); | 16592 CHECK_EQ(2, fatal_error_callback_counter); |
| 16593 CHECK(v8::String::Empty(isolate).IsEmpty()); | 16593 CHECK(v8::String::Empty(isolate).IsEmpty()); |
| 16594 CHECK_EQ(3, fatal_error_callback_counter); | 16594 CHECK_EQ(3, fatal_error_callback_counter); |
| 16595 } | 16595 } |
| 16596 |
| 16597 |
| 16598 THREADED_TEST(Regress137002a) { |
| 16599 i::FLAG_allow_natives_syntax = true; |
| 16600 v8::HandleScope scope; |
| 16601 LocalContext context; |
| 16602 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 16603 templ->SetAccessor(v8_str("foo"), |
| 16604 GetterWhichReturns42, |
| 16605 SetterWhichSetsYOnThisTo23); |
| 16606 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
| 16607 |
| 16608 // Turn monomorphic on slow object with native accessor, then turn |
| 16609 // polymorphic, finally optimize to create negative lookup and fail. |
| 16610 CompileRun("function f(x) { return x.foo; }" |
| 16611 "%OptimizeObjectForAddingMultipleProperties(obj, 1);" |
| 16612 "obj.__proto__ = null;" |
| 16613 "f(obj); f(obj); f({});" |
| 16614 "%OptimizeFunctionOnNextCall(f);" |
| 16615 "var result = f(obj);"); |
| 16616 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); |
| 16617 } |
| 16618 |
| 16619 |
| 16620 THREADED_TEST(Regress137002b) { |
| 16621 i::FLAG_allow_natives_syntax = true; |
| 16622 v8::HandleScope scope; |
| 16623 LocalContext context; |
| 16624 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 16625 templ->SetAccessor(v8_str("foo"), |
| 16626 GetterWhichReturns42, |
| 16627 SetterWhichSetsYOnThisTo23); |
| 16628 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
| 16629 |
| 16630 // Turn monomorphic on slow object with native accessor, then just |
| 16631 // delete the property and fail. |
| 16632 CompileRun("function f(x) { return x.foo; }" |
| 16633 "%OptimizeObjectForAddingMultipleProperties(obj, 1);" |
| 16634 "obj.__proto__ = null;" |
| 16635 "f(obj); f(obj); delete obj.foo;" |
| 16636 "var result = f(obj);"); |
| 16637 CHECK(context->Global()->Get(v8_str("result"))->IsUndefined()); |
| 16638 } |
| OLD | NEW |