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

Side by Side Diff: src/api.cc

Issue 6685073: Remember and reuse derived map for external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 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 | « no previous file | src/bootstrapper.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 void* data, 2974 void* data,
2975 ExternalArrayType array_type, 2975 ExternalArrayType array_type,
2976 int length) { 2976 int length) {
2977 i::Handle<i::ExternalArray> array = 2977 i::Handle<i::ExternalArray> array =
2978 FACTORY->NewExternalArray(length, array_type, data); 2978 FACTORY->NewExternalArray(length, array_type, data);
2979 2979
2980 // If the object already has external elements, create a new, unique 2980 // If the object already has external elements, create a new, unique
2981 // map if the element type is now changing, because assumptions about 2981 // map if the element type is now changing, because assumptions about
2982 // generated code based on the receiver's map will be invalid. 2982 // generated code based on the receiver's map will be invalid.
2983 i::Handle<i::HeapObject> elements(object->elements()); 2983 i::Handle<i::HeapObject> elements(object->elements());
2984 bool force_unique_map = 2984 bool cant_reuse_map =
2985 elements->map()->IsUndefined() || 2985 elements->map()->IsUndefined() ||
2986 !elements->map()->has_external_array_elements() || 2986 !elements->map()->has_external_array_elements() ||
2987 elements->map() != HEAP->MapForExternalArrayType(array_type); 2987 elements->map() != HEAP->MapForExternalArrayType(array_type);
2988 if (force_unique_map) { 2988 if (cant_reuse_map) {
2989 i::Handle<i::Map> external_array_map = 2989 i::Handle<i::Map> external_array_map =
2990 FACTORY->NewExternalArrayElementsMap( 2990 FACTORY->GetExternalArrayElementsMap(
2991 i::Handle<i::Map>(object->map())); 2991 i::Handle<i::Map>(object->map()),
2992 array_type,
2993 object->HasFastProperties());
2992 object->set_map(*external_array_map); 2994 object->set_map(*external_array_map);
2993 } 2995 }
2994 object->set_elements(*array); 2996 object->set_elements(*array);
2995 } 2997 }
2996 2998
2997 } // namespace 2999 } // namespace
2998 3000
2999 3001
3000 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { 3002 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
3001 i::Isolate* isolate = i::Isolate::Current(); 3003 i::Isolate* isolate = i::Isolate::Current();
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5658 5660
5659 5661
5660 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5662 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5661 HandleScopeImplementer* thread_local = 5663 HandleScopeImplementer* thread_local =
5662 reinterpret_cast<HandleScopeImplementer*>(storage); 5664 reinterpret_cast<HandleScopeImplementer*>(storage);
5663 thread_local->IterateThis(v); 5665 thread_local->IterateThis(v);
5664 return storage + ArchiveSpacePerThread(); 5666 return storage + ArchiveSpacePerThread();
5665 } 5667 }
5666 5668
5667 } } // namespace v8::internal 5669 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698