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

Side by Side Diff: src/api.cc

Issue 7862036: Share Maps for ElementsKind transitions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 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 | « no previous file | src/factory.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 3303
3304 3304
3305 void PrepareExternalArrayElements(i::Handle<i::JSObject> object, 3305 void PrepareExternalArrayElements(i::Handle<i::JSObject> object,
3306 void* data, 3306 void* data,
3307 ExternalArrayType array_type, 3307 ExternalArrayType array_type,
3308 int length) { 3308 int length) {
3309 i::Isolate* isolate = object->GetIsolate(); 3309 i::Isolate* isolate = object->GetIsolate();
3310 i::Handle<i::ExternalArray> array = 3310 i::Handle<i::ExternalArray> array =
3311 isolate->factory()->NewExternalArray(length, array_type, data); 3311 isolate->factory()->NewExternalArray(length, array_type, data);
3312 3312
3313 // If the object already has external elements, create a new, unique 3313 i::Handle<i::Map> external_array_map =
3314 // map if the element type is now changing, because assumptions about 3314 isolate->factory()->GetElementsTransitionMap(
3315 // generated code based on the receiver's map will be invalid. 3315 object,
3316 i::Handle<i::HeapObject> elements(object->elements()); 3316 GetElementsKindFromExternalArrayType(array_type));
3317 bool cant_reuse_map = 3317
3318 elements->map()->IsUndefined() || 3318 object->set_map(*external_array_map);
3319 !elements->map()->has_external_array_elements() ||
3320 elements->map() != isolate->heap()->MapForExternalArrayType(array_type);
3321 if (cant_reuse_map) {
3322 i::Handle<i::Map> external_array_map =
3323 isolate->factory()->GetElementsTransitionMap(
3324 i::Handle<i::Map>(object->map()),
3325 GetElementsKindFromExternalArrayType(array_type),
3326 object->HasFastProperties());
3327 object->set_map(*external_array_map);
3328 }
3329 object->set_elements(*array); 3319 object->set_elements(*array);
3330 } 3320 }
3331 3321
3332 } // namespace 3322 } // namespace
3333 3323
3334 3324
3335 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { 3325 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
3336 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3326 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3337 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return); 3327 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
3338 ENTER_V8(isolate); 3328 ENTER_V8(isolate);
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
6076 6066
6077 6067
6078 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6068 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6079 HandleScopeImplementer* scope_implementer = 6069 HandleScopeImplementer* scope_implementer =
6080 reinterpret_cast<HandleScopeImplementer*>(storage); 6070 reinterpret_cast<HandleScopeImplementer*>(storage);
6081 scope_implementer->IterateThis(v); 6071 scope_implementer->IterateThis(v);
6082 return storage + ArchiveSpacePerThread(); 6072 return storage + ArchiveSpacePerThread();
6083 } 6073 }
6084 6074
6085 } } // namespace v8::internal 6075 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698