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

Side by Side Diff: src/runtime.cc

Issue 101413006: Implement in-heap backing store for typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports Created 6 years, 11 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
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 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5211 // JavaScript. 5211 // JavaScript.
5212 // In the case of a String object we just need to redirect the assignment to 5212 // In the case of a String object we just need to redirect the assignment to
5213 // the underlying string if the index is in range. Since the underlying 5213 // the underlying string if the index is in range. Since the underlying
5214 // string does nothing with the assignment then we can ignore such 5214 // string does nothing with the assignment then we can ignore such
5215 // assignments. 5215 // assignments.
5216 if (js_object->IsStringObjectWithCharacterAt(index)) { 5216 if (js_object->IsStringObjectWithCharacterAt(index)) {
5217 return value; 5217 return value;
5218 } 5218 }
5219 5219
5220 js_object->ValidateElements(); 5220 js_object->ValidateElements();
5221 if (js_object->HasExternalArrayElements()) { 5221 if (js_object->HasExternalArrayElements() ||
5222 js_object->HasFixedTypedArrayElements()) {
5222 if (!value->IsNumber() && !value->IsUndefined()) { 5223 if (!value->IsNumber() && !value->IsUndefined()) {
5223 bool has_exception; 5224 bool has_exception;
5224 Handle<Object> number = 5225 Handle<Object> number =
5225 Execution::ToNumber(isolate, value, &has_exception); 5226 Execution::ToNumber(isolate, value, &has_exception);
5226 if (has_exception) return Handle<Object>(); // exception 5227 if (has_exception) return Handle<Object>(); // exception
5227 value = number; 5228 value = number;
5228 } 5229 }
5229 } 5230 }
5230 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, 5231 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr,
5231 strict_mode, 5232 strict_mode,
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after
10004 case NON_STRICT_ARGUMENTS_ELEMENTS: 10005 case NON_STRICT_ARGUMENTS_ELEMENTS:
10005 case EXTERNAL_BYTE_ELEMENTS: 10006 case EXTERNAL_BYTE_ELEMENTS:
10006 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 10007 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
10007 case EXTERNAL_SHORT_ELEMENTS: 10008 case EXTERNAL_SHORT_ELEMENTS:
10008 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 10009 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
10009 case EXTERNAL_INT_ELEMENTS: 10010 case EXTERNAL_INT_ELEMENTS:
10010 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 10011 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
10011 case EXTERNAL_FLOAT_ELEMENTS: 10012 case EXTERNAL_FLOAT_ELEMENTS:
10012 case EXTERNAL_DOUBLE_ELEMENTS: 10013 case EXTERNAL_DOUBLE_ELEMENTS:
10013 case EXTERNAL_PIXEL_ELEMENTS: 10014 case EXTERNAL_PIXEL_ELEMENTS:
10015 case UINT8_ELEMENTS:
10016 case INT8_ELEMENTS:
10017 case UINT16_ELEMENTS:
10018 case INT16_ELEMENTS:
10019 case UINT32_ELEMENTS:
10020 case INT32_ELEMENTS:
10021 case FLOAT32_ELEMENTS:
10022 case FLOAT64_ELEMENTS:
10023 case UINT8_CLAMPED_ELEMENTS:
10014 // External arrays are always dense. 10024 // External arrays are always dense.
10015 return length; 10025 return length;
10016 } 10026 }
10017 // As an estimate, we assume that the prototype doesn't contain any 10027 // As an estimate, we assume that the prototype doesn't contain any
10018 // inherited elements. 10028 // inherited elements.
10019 return element_count; 10029 return element_count;
10020 } 10030 }
10021 10031
10022 10032
10023 10033
(...skipping 4859 matching lines...) Expand 10 before | Expand all | Expand 10 after
14883 // Handle last resort GC and make sure to allow future allocations 14893 // Handle last resort GC and make sure to allow future allocations
14884 // to grow the heap without causing GCs (if possible). 14894 // to grow the heap without causing GCs (if possible).
14885 isolate->counters()->gc_last_resort_from_js()->Increment(); 14895 isolate->counters()->gc_last_resort_from_js()->Increment();
14886 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14887 "Runtime::PerformGC"); 14897 "Runtime::PerformGC");
14888 } 14898 }
14889 } 14899 }
14890 14900
14891 14901
14892 } } // namespace v8::internal 14902 } } // namespace v8::internal
OLDNEW
« src/objects-visiting.cc ('K') | « src/objects-visiting-inl.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698