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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2567033003: [promises] Port CreateResolvingFunctions to TF (Closed)
Patch Set: fix nits 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/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('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 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 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 } 1375 }
1376 1376
1377 Node* CodeStubAssembler::StoreContextElement(Node* context, Node* slot_index, 1377 Node* CodeStubAssembler::StoreContextElement(Node* context, Node* slot_index,
1378 Node* value) { 1378 Node* value) {
1379 Node* offset = 1379 Node* offset =
1380 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), 1380 IntPtrAdd(WordShl(slot_index, kPointerSizeLog2),
1381 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); 1381 IntPtrConstant(Context::kHeaderSize - kHeapObjectTag));
1382 return Store(context, offset, value); 1382 return Store(context, offset, value);
1383 } 1383 }
1384 1384
1385 Node* CodeStubAssembler::StoreContextElementNoWriteBarrier(Node* context,
1386 int slot_index,
1387 Node* value) {
1388 int offset = Context::SlotOffset(slot_index);
1389 return StoreNoWriteBarrier(MachineRepresentation::kTagged, context,
1390 IntPtrConstant(offset), value);
1391 }
1392
1385 Node* CodeStubAssembler::LoadNativeContext(Node* context) { 1393 Node* CodeStubAssembler::LoadNativeContext(Node* context) {
1386 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); 1394 return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX);
1387 } 1395 }
1388 1396
1389 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind, 1397 Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind,
1390 Node* native_context) { 1398 Node* native_context) {
1391 CSA_ASSERT(this, IsNativeContext(native_context)); 1399 CSA_ASSERT(this, IsNativeContext(native_context));
1392 return LoadContextElement(native_context, Context::ArrayMapIndex(kind)); 1400 return LoadContextElement(native_context, Context::ArrayMapIndex(kind));
1393 } 1401 }
1394 1402
(...skipping 6888 matching lines...) Expand 10 before | Expand all | Expand 10 after
8283 return Word32NotEqual(is_debug_active, Int32Constant(0)); 8291 return Word32NotEqual(is_debug_active, Int32Constant(0));
8284 } 8292 }
8285 8293
8286 Node* CodeStubAssembler::IsPromiseHookEnabled() { 8294 Node* CodeStubAssembler::IsPromiseHookEnabled() {
8287 Node* const promise_hook = Load( 8295 Node* const promise_hook = Load(
8288 MachineType::Pointer(), 8296 MachineType::Pointer(),
8289 ExternalConstant(ExternalReference::promise_hook_address(isolate()))); 8297 ExternalConstant(ExternalReference::promise_hook_address(isolate())));
8290 return WordNotEqual(promise_hook, IntPtrConstant(0)); 8298 return WordNotEqual(promise_hook, IntPtrConstant(0));
8291 } 8299 }
8292 8300
8301 Node* CodeStubAssembler::AllocateFunctionWithMapAndContext(Node* map,
8302 Node* shared_info,
8303 Node* context) {
8304 Node* const code = BitcastTaggedToWord(
8305 LoadObjectField(shared_info, SharedFunctionInfo::kCodeOffset));
8306 Node* const code_entry =
8307 IntPtrAdd(code, IntPtrConstant(Code::kHeaderSize - kHeapObjectTag));
8308
8309 Node* const fun = Allocate(JSFunction::kSize);
8310 StoreMapNoWriteBarrier(fun, map);
8311 StoreObjectFieldRoot(fun, JSObject::kPropertiesOffset,
8312 Heap::kEmptyFixedArrayRootIndex);
8313 StoreObjectFieldRoot(fun, JSObject::kElementsOffset,
8314 Heap::kEmptyFixedArrayRootIndex);
8315 StoreObjectFieldRoot(fun, JSFunction::kLiteralsOffset,
8316 Heap::kEmptyLiteralsArrayRootIndex);
8317 StoreObjectFieldRoot(fun, JSFunction::kPrototypeOrInitialMapOffset,
8318 Heap::kTheHoleValueRootIndex);
8319 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kSharedFunctionInfoOffset,
8320 shared_info);
8321 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kContextOffset, context);
8322 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kCodeEntryOffset, code_entry,
8323 MachineType::PointerRepresentation());
8324 StoreObjectFieldRoot(fun, JSFunction::kNextFunctionLinkOffset,
8325 Heap::kUndefinedValueRootIndex);
8326
8327 return fun;
8328 }
8329
8293 Node* CodeStubAssembler::AllocateJSPromise(Node* context) { 8330 Node* CodeStubAssembler::AllocateJSPromise(Node* context) {
8294 Node* const native_context = LoadNativeContext(context); 8331 Node* const native_context = LoadNativeContext(context);
8295 Node* const promise_fun = 8332 Node* const promise_fun =
8296 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); 8333 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX);
8297 Node* const initial_map = 8334 Node* const initial_map =
8298 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); 8335 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset);
8299 Node* const instance = AllocateJSObjectFromMap(initial_map); 8336 Node* const instance = AllocateJSObjectFromMap(initial_map);
8300 8337
8301 return instance; 8338 return instance;
8302 } 8339 }
(...skipping 27 matching lines...) Expand all
8330 Heap::kUndefinedValueRootIndex); 8367 Heap::kUndefinedValueRootIndex);
8331 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, 8368 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset,
8332 Heap::kUndefinedValueRootIndex); 8369 Heap::kUndefinedValueRootIndex);
8333 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, 8370 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset,
8334 context); 8371 context);
8335 return result; 8372 return result;
8336 } 8373 }
8337 8374
8338 } // namespace internal 8375 } // namespace internal
8339 } // namespace v8 8376 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698