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

Side by Side Diff: src/code-stubs.cc

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/compiler.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
11 #include "src/code-factory.h" 11 #include "src/code-factory.h"
12 #include "src/code-stub-assembler.h" 12 #include "src/code-stub-assembler.h"
13 #include "src/factory.h" 13 #include "src/factory.h"
14 #include "src/gdb-jit.h" 14 #include "src/gdb-jit.h"
15 #include "src/ic/handler-compiler.h" 15 #include "src/ic/handler-compiler.h"
16 #include "src/ic/ic.h" 16 #include "src/ic/ic.h"
17 #include "src/macro-assembler.h" 17 #include "src/macro-assembler.h"
18 18
19 namespace v8 { 19 namespace v8 {
20 namespace internal { 20 namespace internal {
21 21
22 22
23 RUNTIME_FUNCTION(UnexpectedStubMiss) { 23 RUNTIME_FUNCTION(UnexpectedStubMiss) {
24 FATAL("Unexpected deopt of a stub"); 24 FATAL("Unexpected deopt of a stub");
25 return Smi::kZero; 25 return Smi::FromInt(0);
26 } 26 }
27 27
28 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub) 28 CodeStubDescriptor::CodeStubDescriptor(CodeStub* stub)
29 : isolate_(stub->isolate()), 29 : isolate_(stub->isolate()),
30 call_descriptor_(stub->GetCallInterfaceDescriptor()), 30 call_descriptor_(stub->GetCallInterfaceDescriptor()),
31 stack_parameter_count_(no_reg), 31 stack_parameter_count_(no_reg),
32 hint_stack_parameter_count_(-1), 32 hint_stack_parameter_count_(-1),
33 function_mode_(NOT_JS_FUNCTION_STUB_MODE), 33 function_mode_(NOT_JS_FUNCTION_STUB_MODE),
34 deoptimization_handler_(NULL), 34 deoptimization_handler_(NULL),
35 miss_handler_(), 35 miss_handler_(),
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 CodeStubAssembler::SMI_PARAMETERS); 2520 CodeStubAssembler::SMI_PARAMETERS);
2521 2521
2522 Node* boilerplate = assembler->LoadObjectField( 2522 Node* boilerplate = assembler->LoadObjectField(
2523 allocation_site, AllocationSite::kTransitionInfoOffset); 2523 allocation_site, AllocationSite::kTransitionInfoOffset);
2524 Node* boilerplate_map = assembler->LoadMap(boilerplate); 2524 Node* boilerplate_map = assembler->LoadMap(boilerplate);
2525 Node* boilerplate_elements = assembler->LoadElements(boilerplate); 2525 Node* boilerplate_elements = assembler->LoadElements(boilerplate);
2526 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements); 2526 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements);
2527 allocation_site = 2527 allocation_site =
2528 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; 2528 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr;
2529 2529
2530 Node* zero = assembler->SmiConstant(Smi::kZero); 2530 Node* zero = assembler->SmiConstant(Smi::FromInt(0));
2531 assembler->GotoIf(assembler->SmiEqual(capacity, zero), &zero_capacity); 2531 assembler->GotoIf(assembler->SmiEqual(capacity, zero), &zero_capacity);
2532 2532
2533 Node* elements_map = assembler->LoadMap(boilerplate_elements); 2533 Node* elements_map = assembler->LoadMap(boilerplate_elements);
2534 assembler->GotoIf(assembler->IsFixedCOWArrayMap(elements_map), &cow_elements); 2534 assembler->GotoIf(assembler->IsFixedCOWArrayMap(elements_map), &cow_elements);
2535 2535
2536 assembler->GotoIf(assembler->IsFixedArrayMap(elements_map), &fast_elements); 2536 assembler->GotoIf(assembler->IsFixedArrayMap(elements_map), &fast_elements);
2537 { 2537 {
2538 assembler->Comment("fast double elements path"); 2538 assembler->Comment("fast double elements path");
2539 if (FLAG_debug_code) { 2539 if (FLAG_debug_code) {
2540 Label correct_elements_map(assembler), abort(assembler, Label::kDeferred); 2540 Label correct_elements_map(assembler), abort(assembler, Label::kDeferred);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && 2827 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE &&
2828 override_mode() != DISABLE_ALLOCATION_SITES; 2828 override_mode() != DISABLE_ALLOCATION_SITES;
2829 Node* allocation_site = 2829 Node* allocation_site =
2830 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite) 2830 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite)
2831 : nullptr; 2831 : nullptr;
2832 Node* array_map = 2832 Node* array_map =
2833 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); 2833 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
2834 Node* array = assembler->AllocateJSArray( 2834 Node* array = assembler->AllocateJSArray(
2835 elements_kind(), array_map, 2835 elements_kind(), array_map,
2836 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), 2836 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
2837 assembler->SmiConstant(Smi::kZero), allocation_site); 2837 assembler->SmiConstant(Smi::FromInt(0)), allocation_site);
2838 assembler->Return(array); 2838 assembler->Return(array);
2839 } 2839 }
2840 2840
2841 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( 2841 void InternalArrayNoArgumentConstructorStub::GenerateAssembly(
2842 CodeStubAssembler* assembler) const { 2842 CodeStubAssembler* assembler) const {
2843 typedef compiler::Node Node; 2843 typedef compiler::Node Node;
2844 Node* array_map = 2844 Node* array_map =
2845 assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction), 2845 assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction),
2846 JSFunction::kPrototypeOrInitialMapOffset); 2846 JSFunction::kPrototypeOrInitialMapOffset);
2847 Node* array = assembler->AllocateJSArray( 2847 Node* array = assembler->AllocateJSArray(
2848 elements_kind(), array_map, 2848 elements_kind(), array_map,
2849 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), 2849 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
2850 assembler->SmiConstant(Smi::kZero), nullptr); 2850 assembler->SmiConstant(Smi::FromInt(0)), nullptr);
2851 assembler->Return(array); 2851 assembler->Return(array);
2852 } 2852 }
2853 2853
2854 namespace { 2854 namespace {
2855 2855
2856 template <typename Descriptor> 2856 template <typename Descriptor>
2857 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, 2857 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
2858 ElementsKind elements_kind, 2858 ElementsKind elements_kind,
2859 compiler::Node* array_map, 2859 compiler::Node* array_map,
2860 compiler::Node* allocation_site, 2860 compiler::Node* allocation_site,
2861 AllocationSiteMode mode) { 2861 AllocationSiteMode mode) {
2862 typedef compiler::Node Node; 2862 typedef compiler::Node Node;
2863 typedef CodeStubAssembler::Label Label; 2863 typedef CodeStubAssembler::Label Label;
2864 2864
2865 Label ok(assembler); 2865 Label ok(assembler);
2866 Label smi_size(assembler); 2866 Label smi_size(assembler);
2867 Label small_smi_size(assembler); 2867 Label small_smi_size(assembler);
2868 Label call_runtime(assembler, Label::kDeferred); 2868 Label call_runtime(assembler, Label::kDeferred);
2869 2869
2870 Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); 2870 Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
2871 assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime); 2871 assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime);
2872 2872
2873 assembler->Bind(&smi_size); 2873 assembler->Bind(&smi_size);
2874 2874
2875 if (IsFastPackedElementsKind(elements_kind)) { 2875 if (IsFastPackedElementsKind(elements_kind)) {
2876 Label abort(assembler, Label::kDeferred); 2876 Label abort(assembler, Label::kDeferred);
2877 assembler->Branch( 2877 assembler->Branch(
2878 assembler->SmiEqual(size, assembler->SmiConstant(Smi::kZero)), 2878 assembler->SmiEqual(size, assembler->SmiConstant(Smi::FromInt(0))),
2879 &small_smi_size, &abort); 2879 &small_smi_size, &abort);
2880 2880
2881 assembler->Bind(&abort); 2881 assembler->Bind(&abort);
2882 Node* reason = 2882 Node* reason =
2883 assembler->SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray)); 2883 assembler->SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray));
2884 Node* context = assembler->Parameter(Descriptor::kContext); 2884 Node* context = assembler->Parameter(Descriptor::kContext);
2885 assembler->TailCallRuntime(Runtime::kAbort, context, reason); 2885 assembler->TailCallRuntime(Runtime::kAbort, context, reason);
2886 } else { 2886 } else {
2887 int element_size = 2887 int element_size =
2888 IsFastDoubleElementsKind(elements_kind) ? kDoubleSize : kPointerSize; 2888 IsFastDoubleElementsKind(elements_kind) ? kDoubleSize : kPointerSize;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 3007
3008 if (type == MachineType::Pointer()) { 3008 if (type == MachineType::Pointer()) {
3009 return Representation::External(); 3009 return Representation::External();
3010 } 3010 }
3011 3011
3012 return Representation::Tagged(); 3012 return Representation::Tagged();
3013 } 3013 }
3014 3014
3015 } // namespace internal 3015 } // namespace internal
3016 } // namespace v8 3016 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698