Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: test/cctest/test-heap.cc

Issue 23495011: Handlify JSObject::SetIdentityHash method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-dictionary.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 2684
2685 for (int i = 0; i < 2; i++) { 2685 for (int i = 0; i < 2; i++) {
2686 // Store identity hash first and common hidden property second. 2686 // Store identity hash first and common hidden property second.
2687 v8::Handle<v8::Object> obj = v8::Object::New(); 2687 v8::Handle<v8::Object> obj = v8::Object::New();
2688 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj); 2688 Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj);
2689 CHECK(internal_obj->HasFastProperties()); 2689 CHECK(internal_obj->HasFastProperties());
2690 2690
2691 // In the first iteration, set hidden value first and identity hash second. 2691 // In the first iteration, set hidden value first and identity hash second.
2692 // In the second iteration, reverse the order. 2692 // In the second iteration, reverse the order.
2693 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value); 2693 if (i == 0) obj->SetHiddenValue(v8_str("key string"), value);
2694 MaybeObject* maybe_obj = internal_obj->SetIdentityHash(hash, 2694 JSObject::SetIdentityHash(internal_obj, hash);
2695 ALLOW_CREATION);
2696 CHECK(!maybe_obj->IsFailure());
2697 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value); 2695 if (i == 1) obj->SetHiddenValue(v8_str("key string"), value);
2698 2696
2699 // Check values. 2697 // Check values.
2700 CHECK_EQ(hash, 2698 CHECK_EQ(hash,
2701 internal_obj->GetHiddenProperty(heap->identity_hash_string())); 2699 internal_obj->GetHiddenProperty(heap->identity_hash_string()));
2702 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string")))); 2700 CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string"))));
2703 2701
2704 // Check size. 2702 // Check size.
2705 DescriptorArray* descriptors = internal_obj->map()->instance_descriptors(); 2703 DescriptorArray* descriptors = internal_obj->map()->instance_descriptors();
2706 ObjectHashTable* hashtable = ObjectHashTable::cast( 2704 ObjectHashTable* hashtable = ObjectHashTable::cast(
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
3446 " var a = new Array(n);" 3444 " var a = new Array(n);"
3447 " for (var i = 0; i < n; i += 100) a[i] = i;" 3445 " for (var i = 0; i < n; i += 100) a[i] = i;"
3448 "};" 3446 "};"
3449 "f(10 * 1024 * 1024);"); 3447 "f(10 * 1024 * 1024);");
3450 IncrementalMarking* marking = HEAP->incremental_marking(); 3448 IncrementalMarking* marking = HEAP->incremental_marking();
3451 if (marking->IsStopped()) marking->Start(); 3449 if (marking->IsStopped()) marking->Start();
3452 // This big step should be sufficient to mark the whole array. 3450 // This big step should be sufficient to mark the whole array.
3453 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3451 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3454 ASSERT(marking->IsComplete()); 3452 ASSERT(marking->IsComplete());
3455 } 3453 }
OLDNEW
« no previous file with comments | « test/cctest/test-dictionary.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698