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

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

Issue 45010: Remove all uses of StringShape variables, since that has proven... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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 | « src/runtime.cc ('k') | test/cctest/test-regexp.cc » ('j') | 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 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 CHECK(Top::context()->global()->HasLocalProperty(obj_name)); 247 CHECK(Top::context()->global()->HasLocalProperty(obj_name));
248 CHECK(Top::context()->global()->GetProperty(obj_name)->IsJSObject()); 248 CHECK(Top::context()->global()->GetProperty(obj_name)->IsJSObject());
249 obj = JSObject::cast(Top::context()->global()->GetProperty(obj_name)); 249 obj = JSObject::cast(Top::context()->global()->GetProperty(obj_name));
250 prop_name = String::cast(Heap::LookupAsciiSymbol("theSlot")); 250 prop_name = String::cast(Heap::LookupAsciiSymbol("theSlot"));
251 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(prop_name)); 251 CHECK_EQ(Smi::FromInt(23), obj->GetProperty(prop_name));
252 } 252 }
253 253
254 254
255 static void VerifyStringAllocation(const char* string) { 255 static void VerifyStringAllocation(const char* string) {
256 String* s = String::cast(Heap::AllocateStringFromUtf8(CStrVector(string))); 256 String* s = String::cast(Heap::AllocateStringFromUtf8(CStrVector(string)));
257 StringShape shape(s); 257 CHECK_EQ(static_cast<int>(strlen(string)), s->length());
258 CHECK_EQ(static_cast<int>(strlen(string)), s->length(shape)); 258 for (int index = 0; index < s->length(); index++) {
259 for (int index = 0; index < s->length(shape); index++) { 259 CHECK_EQ(static_cast<uint16_t>(string[index]), s->Get(index)); }
260 CHECK_EQ(static_cast<uint16_t>(string[index]), s->Get(shape, index)); }
261 } 260 }
262 261
263 262
264 TEST(String) { 263 TEST(String) {
265 InitializeVM(); 264 InitializeVM();
266 265
267 VerifyStringAllocation("a"); 266 VerifyStringAllocation("a");
268 VerifyStringAllocation("ab"); 267 VerifyStringAllocation("ab");
269 VerifyStringAllocation("abc"); 268 VerifyStringAllocation("abc");
270 VerifyStringAllocation("abcd"); 269 VerifyStringAllocation("abcd");
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 objs[next_objs_index++] = 776 objs[next_objs_index++] =
778 Factory::NewStringFromAscii(CStrVector(str), TENURED); 777 Factory::NewStringFromAscii(CStrVector(str), TENURED);
779 delete[] str; 778 delete[] str;
780 779
781 // Add a Map object to look for. 780 // Add a Map object to look for.
782 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); 781 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map());
783 782
784 CHECK_EQ(objs_count, next_objs_index); 783 CHECK_EQ(objs_count, next_objs_index);
785 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); 784 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count));
786 } 785 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698