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

Side by Side Diff: src/heap.cc

Issue 11443: Ensure that external symbols have hash codes. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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 | « no previous file | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 // have to patch the external string resource after the callback. 2135 // have to patch the external string resource after the callback.
2136 DummyExternalStringResource dummy_resource(chars); 2136 DummyExternalStringResource dummy_resource(chars);
2137 Object* obj = AllocateExternalSymbolFromTwoByte(&dummy_resource); 2137 Object* obj = AllocateExternalSymbolFromTwoByte(&dummy_resource);
2138 if (obj->IsFailure()) return obj; 2138 if (obj->IsFailure()) return obj;
2139 // Perform callback. 2139 // Perform callback.
2140 v8::String::ExternalStringResource* resource = 2140 v8::String::ExternalStringResource* resource =
2141 global_external_symbol_callback_(string.start(), string.length()); 2141 global_external_symbol_callback_(string.start(), string.length());
2142 // Patch the resource pointer of the result. 2142 // Patch the resource pointer of the result.
2143 ExternalTwoByteString* result = ExternalTwoByteString::cast(obj); 2143 ExternalTwoByteString* result = ExternalTwoByteString::cast(obj);
2144 result->set_resource(resource); 2144 result->set_resource(resource);
2145 // Force hash code to be computed.
2146 result->Hash();
2145 ASSERT(result->IsEqualTo(string)); 2147 ASSERT(result->IsEqualTo(string));
2146 return result; 2148 return result;
2147 } 2149 }
2148 2150
2149 2151
2150 Object* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) { 2152 Object* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) {
2151 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 2153 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
2152 int size = SeqAsciiString::SizeFor(length); 2154 int size = SeqAsciiString::SizeFor(length);
2153 if (size > MaxHeapObjectSize()) { 2155 if (size > MaxHeapObjectSize()) {
2154 space = LO_SPACE; 2156 space = LO_SPACE;
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3312 #ifdef DEBUG 3314 #ifdef DEBUG
3313 bool Heap::GarbageCollectionGreedyCheck() { 3315 bool Heap::GarbageCollectionGreedyCheck() {
3314 ASSERT(FLAG_gc_greedy); 3316 ASSERT(FLAG_gc_greedy);
3315 if (Bootstrapper::IsActive()) return true; 3317 if (Bootstrapper::IsActive()) return true;
3316 if (disallow_allocation_failure()) return true; 3318 if (disallow_allocation_failure()) return true;
3317 return CollectGarbage(0, NEW_SPACE); 3319 return CollectGarbage(0, NEW_SPACE);
3318 } 3320 }
3319 #endif 3321 #endif
3320 3322
3321 } } // namespace v8::internal 3323 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698