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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 v8::Isolate* isolate = CcTest::isolate(); | 1930 v8::Isolate* isolate = CcTest::isolate(); |
1931 v8::HandleScope scope(isolate); | 1931 v8::HandleScope scope(isolate); |
1932 LocalContext env; | 1932 LocalContext env; |
1933 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); | 1933 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); |
1934 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); | 1934 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); |
1935 CHECK(a->map()->instance_descriptors()->IsFixedArray()); | 1935 CHECK(a->map()->instance_descriptors()->IsFixedArray()); |
1936 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 1936 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
1937 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); | 1937 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); |
1938 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 1938 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
1939 // But we should still have an ExecutableAccessorInfo. | 1939 // But we should still have an ExecutableAccessorInfo. |
1940 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
1941 i::LookupResult lookup(i_isolate); | |
1942 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); | 1940 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); |
1943 i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR); | 1941 i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR); |
1944 CHECK_EQ(i::LookupIterator::ACCESSOR, it.state()); | 1942 CHECK_EQ(i::LookupIterator::ACCESSOR, it.state()); |
1945 CHECK(it.GetAccessors()->IsExecutableAccessorInfo()); | 1943 CHECK(it.GetAccessors()->IsExecutableAccessorInfo()); |
1946 } | 1944 } |
1947 | 1945 |
1948 | 1946 |
1949 THREADED_TEST(UndefinedIsNotEnumerable) { | 1947 THREADED_TEST(UndefinedIsNotEnumerable) { |
1950 LocalContext env; | 1948 LocalContext env; |
1951 v8::HandleScope scope(env->GetIsolate()); | 1949 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 10354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12306 break; | 12304 break; |
12307 } | 12305 } |
12308 } | 12306 } |
12309 | 12307 |
12310 | 12308 |
12311 UNINITIALIZED_TEST(SetJitCodeEventHandler) { | 12309 UNINITIALIZED_TEST(SetJitCodeEventHandler) { |
12312 i::FLAG_stress_compaction = true; | 12310 i::FLAG_stress_compaction = true; |
12313 i::FLAG_incremental_marking = false; | 12311 i::FLAG_incremental_marking = false; |
12314 if (i::FLAG_never_compact) return; | 12312 if (i::FLAG_never_compact) return; |
12315 const char* script = | 12313 const char* script = |
12316 "function bar() {" | 12314 "function bar() {" |
12317 " var sum = 0;" | 12315 " var sum = 0;" |
12318 " for (i = 0; i < 100; ++i)" | 12316 " for (i = 0; i < 10; ++i)" |
12319 " sum = foo(i);" | 12317 " sum = foo(i);" |
12320 " return sum;" | 12318 " return sum;" |
12321 "}" | 12319 "}" |
12322 "function foo(i) { return i * i; };" | 12320 "function foo(i) { return i; };" |
12323 "bar();"; | 12321 "bar();"; |
12324 | 12322 |
12325 // Run this test in a new isolate to make sure we don't | 12323 // Run this test in a new isolate to make sure we don't |
12326 // have remnants of state from other code. | 12324 // have remnants of state from other code. |
12327 v8::Isolate* isolate = v8::Isolate::New(); | 12325 v8::Isolate* isolate = v8::Isolate::New(); |
12328 isolate->Enter(); | 12326 isolate->Enter(); |
12329 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 12327 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
12330 i::Heap* heap = i_isolate->heap(); | 12328 i::Heap* heap = i_isolate->heap(); |
12331 | 12329 |
12332 // Start with a clean slate. | 12330 // Start with a clean slate. |
12333 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); | 12331 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); |
(...skipping 9607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21941 } | 21939 } |
21942 { | 21940 { |
21943 v8::TryCatch try_catch; | 21941 v8::TryCatch try_catch; |
21944 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); | 21942 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); |
21945 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, | 21943 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, |
21946 length).IsEmpty()); | 21944 length).IsEmpty()); |
21947 CHECK(try_catch.HasCaught()); | 21945 CHECK(try_catch.HasCaught()); |
21948 } | 21946 } |
21949 free(buffer); | 21947 free(buffer); |
21950 } | 21948 } |
OLD | NEW |