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

Side by Side Diff: src/builtins/builtins.cc

Issue 2151163002: [stubs] Improve code generation for ToBoolean. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Fix redness. Created 4 years, 5 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/builtins/builtins.h ('k') | src/code-factory.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/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/api-natives.h" 9 #include "src/api-natives.h"
10 #include "src/base/ieee754.h" 10 #include "src/base/ieee754.h"
(...skipping 5252 matching lines...) Expand 10 before | Expand all | Expand 10 after
5263 // Note: We cannot tail call to the runtime here, as js-to-wasm 5263 // Note: We cannot tail call to the runtime here, as js-to-wasm
5264 // trampolines also use this code currently, and they declare all 5264 // trampolines also use this code currently, and they declare all
5265 // outgoing parameters as untagged, while we would push a tagged 5265 // outgoing parameters as untagged, while we would push a tagged
5266 // object here. 5266 // object here.
5267 Node* result = assembler->CallRuntime(Runtime::kToNumber, context, input); 5267 Node* result = assembler->CallRuntime(Runtime::kToNumber, context, input);
5268 assembler->Return(result); 5268 assembler->Return(result);
5269 } 5269 }
5270 } 5270 }
5271 } 5271 }
5272 5272
5273 // ES6 section 7.1.2 ToBoolean ( argument )
5274 void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) {
5275 typedef compiler::Node Node;
5276 typedef CodeStubAssembler::Label Label;
5277
5278 Node* value = assembler->Parameter(0);
5279
5280 Label return_true(assembler), return_false(assembler);
5281 assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false);
5282
5283 assembler->Bind(&return_true);
5284 assembler->Return(assembler->BooleanConstant(true));
5285
5286 assembler->Bind(&return_false);
5287 assembler->Return(assembler->BooleanConstant(false));
5288 }
5289
5273 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { 5290 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
5274 ElementHandlerCompiler::GenerateStoreSlow(masm); 5291 ElementHandlerCompiler::GenerateStoreSlow(masm);
5275 } 5292 }
5276 5293
5277 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { 5294 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
5278 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); 5295 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm);
5279 } 5296 }
5280 5297
5281 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { 5298 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) {
5282 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); 5299 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY);
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ 5849 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \
5833 Handle<Code> Builtins::Name() { \ 5850 Handle<Code> Builtins::Name() { \
5834 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ 5851 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \
5835 return Handle<Code>(code_address); \ 5852 return Handle<Code>(code_address); \
5836 } 5853 }
5837 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) 5854 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR)
5838 #undef DEFINE_BUILTIN_ACCESSOR 5855 #undef DEFINE_BUILTIN_ACCESSOR
5839 5856
5840 } // namespace internal 5857 } // namespace internal
5841 } // namespace v8 5858 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/code-factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698