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 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 *v8::Handle<v8::Function>::Cast( | 3284 *v8::Handle<v8::Function>::Cast( |
3285 CcTest::global()->Get(v8_str("g")))); | 3285 CcTest::global()->Get(v8_str("g")))); |
3286 | 3286 |
3287 OFStream os(stdout); | 3287 OFStream os(stdout); |
3288 g->shared()->Print(os); | 3288 g->shared()->Print(os); |
3289 os << std::endl; | 3289 os << std::endl; |
3290 } | 3290 } |
3291 #endif // OBJECT_PRINT | 3291 #endif // OBJECT_PRINT |
3292 | 3292 |
3293 | 3293 |
3294 TEST(Regress2211) { | |
3295 CcTest::InitializeVM(); | |
3296 v8::HandleScope scope(CcTest::isolate()); | |
3297 | |
3298 v8::Handle<v8::String> value = v8_str("val string"); | |
3299 Smi* hash = Smi::FromInt(321); | |
3300 Factory* factory = CcTest::i_isolate()->factory(); | |
3301 | |
3302 for (int i = 0; i < 2; i++) { | |
3303 // Store identity hash first and common hidden property second. | |
3304 v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate()); | |
3305 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj); | |
3306 CHECK(internal_obj->HasFastProperties()); | |
3307 | |
3308 // In the first iteration, set hidden value first and identity hash second. | |
3309 // In the second iteration, reverse the order. | |
3310 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value); | |
3311 JSObject::SetIdentityHash(internal_obj, handle(hash, CcTest::i_isolate())); | |
3312 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value); | |
3313 | |
3314 // Check values. | |
3315 CHECK_EQ(hash, | |
3316 internal_obj->GetHiddenProperty(factory->identity_hash_string())); | |
3317 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string")))); | |
3318 | |
3319 // Check size. | |
3320 FieldIndex index = FieldIndex::ForDescriptor(internal_obj->map(), 0); | |
3321 ObjectHashTable* hashtable = ObjectHashTable::cast( | |
3322 internal_obj->RawFastPropertyAt(index)); | |
3323 // HashTable header (5) and 4 initial entries (8). | |
3324 CHECK_LE(hashtable->SizeFor(hashtable->length()), 13 * kPointerSize); | |
3325 } | |
3326 } | |
3327 | |
3328 | |
3329 TEST(IncrementalMarkingPreservesMonomorphicCallIC) { | 3294 TEST(IncrementalMarkingPreservesMonomorphicCallIC) { |
3330 if (i::FLAG_always_opt) return; | 3295 if (i::FLAG_always_opt) return; |
3331 CcTest::InitializeVM(); | 3296 CcTest::InitializeVM(); |
3332 v8::HandleScope scope(CcTest::isolate()); | 3297 v8::HandleScope scope(CcTest::isolate()); |
3333 v8::Local<v8::Value> fun1, fun2; | 3298 v8::Local<v8::Value> fun1, fun2; |
3334 | 3299 |
3335 { | 3300 { |
3336 LocalContext env; | 3301 LocalContext env; |
3337 CompileRun("function fun() {};"); | 3302 CompileRun("function fun() {};"); |
3338 fun1 = env->Global()->Get(v8_str("fun")); | 3303 fun1 = env->Global()->Get(v8_str("fun")); |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5592 "check();"; | 5557 "check();"; |
5593 CompileRun(test); | 5558 CompileRun(test); |
5594 | 5559 |
5595 const char* flag = "--turbo-filter=*"; | 5560 const char* flag = "--turbo-filter=*"; |
5596 FlagList::SetFlagsFromString(flag, StrLength(flag)); | 5561 FlagList::SetFlagsFromString(flag, StrLength(flag)); |
5597 FLAG_always_opt = true; | 5562 FLAG_always_opt = true; |
5598 FLAG_turbo_exceptions = true; | 5563 FLAG_turbo_exceptions = true; |
5599 | 5564 |
5600 CompileRun(test); | 5565 CompileRun(test); |
5601 } | 5566 } |
OLD | NEW |