Chromium Code Reviews

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 78583002: [v8-dev] ARM: Optimize TypeofIsAndBranch (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« src/arm/macro-assembler-arm.h ('K') | « src/arm/macro-assembler-arm.h ('k') | no next file » | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1998 matching lines...)
2009 Heap::kSlicedAsciiStringMapRootIndex, 2009 Heap::kSlicedAsciiStringMapRootIndex,
2010 scratch1, 2010 scratch1,
2011 scratch2); 2011 scratch2);
2012 } 2012 }
2013 2013
2014 2014
2015 void MacroAssembler::CompareObjectType(Register object, 2015 void MacroAssembler::CompareObjectType(Register object,
2016 Register map, 2016 Register map,
2017 Register type_reg, 2017 Register type_reg,
2018 InstanceType type) { 2018 InstanceType type) {
2019 const Register temp = type_reg.is(no_reg) ? ip : type_reg;
2020
2019 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); 2021 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
2020 CompareInstanceType(map, type_reg, type); 2022 CompareInstanceType(map, temp, type);
2023 }
2024
2025
2026 void MacroAssembler::CheckObjectTypeRange(Register object,
2027 Register map,
2028 InstanceType min_type,
2029 InstanceType max_type,
2030 Label* false_label) {
2031 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096);
2032 STATIC_ASSERT(LAST_TYPE < 256);
2033 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
2034 ldrb(ip, FieldMemOperand(map, Map::kInstanceTypeOffset));
2035 sub(ip, ip, Operand(min_type));
2036 cmp(ip, Operand(max_type - min_type));
2037 b(hi, false_label);
2021 } 2038 }
2022 2039
2023 2040
2024 void MacroAssembler::CompareInstanceType(Register map, 2041 void MacroAssembler::CompareInstanceType(Register map,
2025 Register type_reg, 2042 Register type_reg,
2026 InstanceType type) { 2043 InstanceType type) {
2044 // Registers map and type_reg can be ip. These two lines assert
2045 // that ip can be used with the two instructions (the constants
2046 // won't never need ip).
ulan 2013/11/22 15:43:46 nit: either "won't ever need" or "will never need"
2047 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096);
2048 STATIC_ASSERT(LAST_TYPE < 256);
2027 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); 2049 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
2028 cmp(type_reg, Operand(type)); 2050 cmp(type_reg, Operand(type));
2029 } 2051 }
2030 2052
2031 2053
2032 void MacroAssembler::CompareRoot(Register obj, 2054 void MacroAssembler::CompareRoot(Register obj,
2033 Heap::RootListIndex index) { 2055 Heap::RootListIndex index) {
2034 ASSERT(!obj.is(ip)); 2056 ASSERT(!obj.is(ip));
2035 LoadRoot(ip, index); 2057 LoadRoot(ip, index);
2036 cmp(obj, ip); 2058 cmp(obj, ip);
(...skipping 2013 matching lines...)
4050 void CodePatcher::EmitCondition(Condition cond) { 4072 void CodePatcher::EmitCondition(Condition cond) {
4051 Instr instr = Assembler::instr_at(masm_.pc_); 4073 Instr instr = Assembler::instr_at(masm_.pc_);
4052 instr = (instr & ~kCondMask) | cond; 4074 instr = (instr & ~kCondMask) | cond;
4053 masm_.emit(instr); 4075 masm_.emit(instr);
4054 } 4076 }
4055 4077
4056 4078
4057 } } // namespace v8::internal 4079 } } // namespace v8::internal
4058 4080
4059 #endif // V8_TARGET_ARCH_ARM 4081 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« src/arm/macro-assembler-arm.h ('K') | « src/arm/macro-assembler-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine