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

Side by Side Diff: src/objects.cc

Issue 2541113004: [Ignition/turbo] Add a NewWithSpread bytecode. (Closed)
Patch Set: Add todo Created 4 years 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
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 } else { 2168 } else {
2169 if (!constructor->IsConstructor()) { 2169 if (!constructor->IsConstructor()) {
2170 THROW_NEW_ERROR(isolate, 2170 THROW_NEW_ERROR(isolate,
2171 NewTypeError(MessageTemplate::kSpeciesNotConstructor), 2171 NewTypeError(MessageTemplate::kSpeciesNotConstructor),
2172 Object); 2172 Object);
2173 } 2173 }
2174 return constructor; 2174 return constructor;
2175 } 2175 }
2176 } 2176 }
2177 2177
2178 bool Object::IterationHasObservableEffects() {
2179 if (IsJSArray()) {
2180 // Check that the spread arg has fast elements
2181 JSArray* spread_array = JSArray::cast(this);
2182 ElementsKind array_kind = spread_array->GetElementsKind();
2183 Isolate* isolate = spread_array->GetIsolate();
2184
2185 // And that it has the orignal ArrayPrototype
2186 JSObject* array_proto = JSObject::cast(spread_array->map()->prototype());
2187 Map* iterator_map = isolate->initial_array_iterator_prototype()->map();
2188
2189 // Check that the iterator acts as expected.
2190 // If IsArrayIteratorLookupChainIntact(), then we know that the initial
2191 // ArrayIterator is being used. If the map of the prototype has changed,
2192 // then take the slow path.
2193 if (isolate->is_initial_array_prototype(array_proto) &&
2194 isolate->IsArrayIteratorLookupChainIntact() &&
2195 isolate->is_initial_array_iterator_prototype_map(iterator_map)) {
2196 if (IsFastPackedElementsKind(array_kind)) {
2197 return false;
2198 }
2199 if (IsFastHoleyElementsKind(array_kind) &&
2200 isolate->IsFastArrayConstructorPrototypeChainIntact()) {
2201 return false;
2202 }
2203 }
2204 }
2205 return true;
2206 }
2178 2207
2179 void Object::ShortPrint(FILE* out) { 2208 void Object::ShortPrint(FILE* out) {
2180 OFStream os(out); 2209 OFStream os(out);
2181 os << Brief(this); 2210 os << Brief(this);
2182 } 2211 }
2183 2212
2184 2213
2185 void Object::ShortPrint(StringStream* accumulator) { 2214 void Object::ShortPrint(StringStream* accumulator) {
2186 std::ostringstream os; 2215 std::ostringstream os;
2187 os << Brief(this); 2216 os << Brief(this);
(...skipping 18328 matching lines...) Expand 10 before | Expand all | Expand 10 after
20516 // depend on this. 20545 // depend on this.
20517 return DICTIONARY_ELEMENTS; 20546 return DICTIONARY_ELEMENTS;
20518 } 20547 }
20519 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20548 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20520 return kind; 20549 return kind;
20521 } 20550 }
20522 } 20551 }
20523 20552
20524 } // namespace internal 20553 } // namespace internal
20525 } // namespace v8 20554 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698