OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/promise-utils.h" | 9 #include "src/promise-utils.h" |
10 | 10 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 compiler::Node* promise) { | 265 compiler::Node* promise) { |
266 typedef compiler::Node Node; | 266 typedef compiler::Node Node; |
267 | 267 |
268 Node* const flags = a->LoadObjectField(promise, JSPromise::kFlagsOffset); | 268 Node* const flags = a->LoadObjectField(promise, JSPromise::kFlagsOffset); |
269 return a->IsSetWord(a->SmiUntag(flags), 1 << JSPromise::kHasHandlerBit); | 269 return a->IsSetWord(a->SmiUntag(flags), 1 << JSPromise::kHasHandlerBit); |
270 } | 270 } |
271 | 271 |
272 void PromiseSetHasHandler(CodeStubAssembler* a, compiler::Node* promise) { | 272 void PromiseSetHasHandler(CodeStubAssembler* a, compiler::Node* promise) { |
273 typedef compiler::Node Node; | 273 typedef compiler::Node Node; |
274 | 274 |
275 Node* const flags = a->LoadObjectField(promise, JSPromise::kFlagsOffset); | 275 Node* const flags = |
| 276 a->SmiUntag(a->LoadObjectField(promise, JSPromise::kFlagsOffset)); |
276 Node* const new_flags = | 277 Node* const new_flags = |
277 a->WordOr(flags, a->IntPtrConstant(1 << JSPromise::kHasHandlerBit)); | 278 a->WordOr(flags, a->IntPtrConstant(1 << JSPromise::kHasHandlerBit)); |
278 a->StoreObjectField(promise, JSPromise::kFlagsOffset, a->SmiTag(new_flags)); | 279 a->StoreObjectField(promise, JSPromise::kFlagsOffset, a->SmiTag(new_flags)); |
279 } | 280 } |
280 | 281 |
281 compiler::Node* SpeciesConstructor(CodeStubAssembler* a, Isolate* isolate, | 282 compiler::Node* SpeciesConstructor(CodeStubAssembler* a, Isolate* isolate, |
282 compiler::Node* context, | 283 compiler::Node* context, |
283 compiler::Node* object, | 284 compiler::Node* object, |
284 compiler::Node* default_constructor) { | 285 compiler::Node* default_constructor) { |
285 typedef compiler::Node Node; | 286 typedef compiler::Node Node; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return var_result.value(); | 339 return var_result.value(); |
339 } | 340 } |
340 | 341 |
341 void AppendPromiseCallback(CodeStubAssembler* a, int offset, | 342 void AppendPromiseCallback(CodeStubAssembler* a, int offset, |
342 compiler::Node* promise, compiler::Node* value) { | 343 compiler::Node* promise, compiler::Node* value) { |
343 typedef compiler::Node Node; | 344 typedef compiler::Node Node; |
344 | 345 |
345 Node* elements = a->LoadObjectField(promise, offset); | 346 Node* elements = a->LoadObjectField(promise, offset); |
346 Node* length = a->LoadFixedArrayBaseLength(elements); | 347 Node* length = a->LoadFixedArrayBaseLength(elements); |
347 CodeStubAssembler::ParameterMode mode = a->OptimalParameterMode(); | 348 CodeStubAssembler::ParameterMode mode = a->OptimalParameterMode(); |
348 length = a->UntagParameter(length, mode); | 349 length = a->TaggedToParameter(length, mode); |
349 | 350 |
350 Node* delta = a->IntPtrOrSmiConstant(1, mode); | 351 Node* delta = a->IntPtrOrSmiConstant(1, mode); |
351 Node* new_capacity = a->IntPtrAdd(length, delta); | 352 Node* new_capacity = a->IntPtrOrSmiAdd(length, delta, mode); |
352 | 353 |
353 const ElementsKind kind = FAST_ELEMENTS; | 354 const ElementsKind kind = FAST_ELEMENTS; |
354 const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER; | 355 const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER; |
355 const CodeStubAssembler::AllocationFlags flags = | 356 const CodeStubAssembler::AllocationFlags flags = |
356 CodeStubAssembler::kAllowLargeObjectAllocation; | 357 CodeStubAssembler::kAllowLargeObjectAllocation; |
357 int additional_offset = 0; | 358 int additional_offset = 0; |
358 | 359 |
359 Node* new_elements = a->AllocateFixedArray(kind, new_capacity, mode, flags); | 360 Node* new_elements = a->AllocateFixedArray(kind, new_capacity, mode, flags); |
360 | 361 |
361 a->CopyFixedArrayElements(kind, elements, new_elements, length, barrier_mode, | 362 a->CopyFixedArrayElements(kind, elements, new_elements, length, barrier_mode, |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 | 863 |
863 Label out(&a); | 864 Label out(&a); |
864 InternalResolvePromise(&a, context, promise, result, &out); | 865 InternalResolvePromise(&a, context, promise, result, &out); |
865 | 866 |
866 a.Bind(&out); | 867 a.Bind(&out); |
867 a.Return(a.UndefinedConstant()); | 868 a.Return(a.UndefinedConstant()); |
868 } | 869 } |
869 | 870 |
870 } // namespace internal | 871 } // namespace internal |
871 } // namespace v8 | 872 } // namespace v8 |
OLD | NEW |