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

Side by Side Diff: src/api.cc

Issue 15172003: Preallocate transitioned maps for TypedArrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | src/heap.h » ('J')
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 5935 matching lines...) Expand 10 before | Expand all | Expand 10 after
5946 obj->set_byte_length(*byte_length_object); 5946 obj->set_byte_length(*byte_length_object);
5947 5947
5948 i::Handle<i::Object> length_object = isolate->factory()->NewNumber( 5948 i::Handle<i::Object> length_object = isolate->factory()->NewNumber(
5949 static_cast<double>(length)); 5949 static_cast<double>(length));
5950 obj->set_length(*length_object); 5950 obj->set_length(*length_object);
5951 5951
5952 i::Handle<i::ExternalArray> elements = 5952 i::Handle<i::ExternalArray> elements =
5953 isolate->factory()->NewExternalArray( 5953 isolate->factory()->NewExternalArray(
5954 static_cast<int>(length), array_type, 5954 static_cast<int>(length), array_type,
5955 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); 5955 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
5956 i::Handle<i::Map> map =
5957 isolate->factory()->GetElementsTransitionMap(
5958 obj, elements_kind);
5959 obj->set_map(*map);
5960 obj->set_elements(*elements); 5956 obj->set_elements(*elements);
5961 return obj; 5957 return obj;
5962 } 5958 }
5963 5959
5964 5960
5965 #define TYPED_ARRAY_NEW(TypedArray, element_type, array_type, elements_kind) \ 5961 #define TYPED_ARRAY_NEW(TypedArray, element_type, array_type, elements_kind) \
5966 Local<TypedArray> TypedArray::New(Handle<ArrayBuffer> array_buffer, \ 5962 Local<TypedArray> TypedArray::New(Handle<ArrayBuffer> array_buffer, \
5967 size_t byte_offset, size_t length) { \ 5963 size_t byte_offset, size_t length) { \
5968 i::Isolate* isolate = i::Isolate::Current(); \ 5964 i::Isolate* isolate = i::Isolate::Current(); \
5969 EnsureInitializedForIsolate(isolate, \ 5965 EnsureInitializedForIsolate(isolate, \
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
7687 7683
7688 v->VisitPointers(blocks_.first(), first_block_limit_); 7684 v->VisitPointers(blocks_.first(), first_block_limit_);
7689 7685
7690 for (int i = 1; i < blocks_.length(); i++) { 7686 for (int i = 1; i < blocks_.length(); i++) {
7691 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7687 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7692 } 7688 }
7693 } 7689 }
7694 7690
7695 7691
7696 } } // namespace v8::internal 7692 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | src/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698