Changeset 172429 in webkit
- Timestamp:
- Aug 11, 2014 8:20:04 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r172413 r172429 1 2014-08-11 Michael Saboff <msaboff@apple.com> 2 3 Eliminate {push,pop}CalleeSaves in favor of individual pushes & pops 4 https://bugs.webkit.org/show_bug.cgi?id=127155 5 6 Reviewed by Geoffrey Garen. 7 8 Eliminated the offline assembler instructions {push,pop}CalleeSaves as well as the 9 ARM64 specific {push,pop}LRAndFP and replaced them with individual push and pop 10 instructions. Where the registers referenced by the added push and pop instructions 11 are not part of the offline assembler register aliases, used a newly added "emit" 12 offline assembler instruction which takes a string literal and outputs that 13 string as a native instruction. 14 15 * llint/LowLevelInterpreter.asm: 16 * offlineasm/arm.rb: 17 * offlineasm/arm64.rb: 18 * offlineasm/ast.rb: 19 * offlineasm/cloop.rb: 20 * offlineasm/instructions.rb: 21 * offlineasm/mips.rb: 22 * offlineasm/parser.rb: 23 * offlineasm/sh4.rb: 24 * offlineasm/transform.rb: 25 * offlineasm/x86.rb: 26 1 27 2014-08-11 Mark Lam <mark.lam@apple.com> 2 28 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r172176 r172429 247 247 end 248 248 249 macro pushCalleeSaves() 250 if C_LOOP 251 elsif ARM or ARMv7_TRADITIONAL 252 emit "push {r4-r10}" 253 elsif ARMv7 254 emit "push {r4-r6, r8-r11}" 255 elsif ARM64 256 emit "stp x20, x19, [sp, #-16]!" 257 emit "stp x22, x21, [sp, #-16]!" 258 emit "stp x24, x23, [sp, #-16]!" 259 emit "stp x26, x25, [sp, #-16]!" 260 emit "stp x28, x27, [sp, #-16]!" 261 elsif MIPS 262 emit "addiu $sp, $sp, -20" 263 emit "sw $20, 16($sp)" 264 emit "sw $19, 12($sp)" 265 emit "sw $18, 8($sp)" 266 emit "sw $17, 4($sp)" 267 emit "sw $16, 0($sp)" 268 elsif SH4 269 emit "mov.l r13, @-r15" 270 emit "mov.l r11, @-r15" 271 emit "mov.l r10, @-r15" 272 emit "mov.l r9, @-r15" 273 emit "mov.l r8, @-r15" 274 elsif X86 275 emit "push %esi" 276 emit "push %edi" 277 emit "push %ebx" 278 elsif X86_WIN 279 emit "push esi" 280 emit "push edi" 281 emit "push ebx" 282 elsif X86_64 283 emit "push %r12" 284 emit "push %r13" 285 emit "push %r14" 286 emit "push %r15" 287 emit "push %rbx" 288 elsif X86_64_WIN 289 emit "push r12" 290 emit "push r13" 291 emit "push r14" 292 emit "push r15" 293 emit "push rbx" 294 emit "push rdi" 295 emit "push rsi" 296 end 297 end 298 299 macro popCalleeSaves() 300 if C_LOOP 301 elsif ARM or ARMv7_TRADITIONAL 302 emit "pop {r4-r10}" 303 elsif ARMv7 304 emit "pop {r4-r6, r8-r11}" 305 elsif ARM64 306 emit "ldp x28, x27, [sp], #16" 307 emit "ldp x26, x25, [sp], #16" 308 emit "ldp x24, x23, [sp], #16" 309 emit "ldp x22, x21, [sp], #16" 310 emit "ldp x20, x19, [sp], #16" 311 elsif MIPS 312 emit "lw $16, 0($sp)" 313 emit "lw $17, 4($sp)" 314 emit "lw $18, 8($sp)" 315 emit "lw $19, 12($sp)" 316 emit "lw $20, 16($sp)" 317 emit "addiu $sp, $sp, 20" 318 elsif SH4 319 emit "mov.l @r15+, r8" 320 emit "mov.l @r15+, r9" 321 emit "mov.l @r15+, r10" 322 emit "mov.l @r15+, r11" 323 emit "mov.l @r15+, r13" 324 elsif X86 325 emit "pop %ebx" 326 emit "pop %edi" 327 emit "pop %esi" 328 elsif X86_WIN 329 emit "pop ebx" 330 emit "pop edi" 331 emit "pop esi" 332 elsif X86_64 333 emit "pop %rbx" 334 emit "pop %r15" 335 emit "pop %r14" 336 emit "pop %r13" 337 emit "pop %r12" 338 elsif X86_64_WIN 339 emit "pop rsi" 340 emit "pop rdi" 341 emit "pop rbx" 342 emit "pop r15" 343 emit "pop r14" 344 emit "pop r13" 345 emit "pop r12" 346 end 347 end 348 249 349 macro preserveCallerPCAndCFR() 250 350 if C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 … … 254 354 push cfr 255 355 elsif ARM64 256 push LRAndFP356 push cfr, lr 257 357 else 258 358 error … … 269 369 pop cfr 270 370 elsif ARM64 271 pop LRAndFP371 pop lr, cfr 272 372 end 273 373 end … … 299 399 push cfr 300 400 elsif ARM64 301 push LRAndFP401 push cfr, lr 302 402 elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 303 403 push lr … … 311 411 pop cfr 312 412 elsif ARM64 313 pop LRAndFP413 pop lr, cfr 314 414 elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 315 415 pop cfr … … 325 425 push cfr 326 426 elsif ARM64 327 push LRAndFP427 push cfr, lr 328 428 elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 329 429 push lr 330 430 push cfr 331 431 end 332 pushCalleeSaves 432 pushCalleeSaves() 333 433 if X86 334 434 subp 12, sp … … 373 473 end 374 474 375 popCalleeSaves 475 popCalleeSaves() 376 476 if X86_64 or X86_64_WIN 377 477 pop t2 … … 380 480 pop cfr 381 481 elsif ARM64 382 pop LRAndFP482 pop lr, cfr 383 483 elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 384 484 pop cfr … … 527 627 # pop the callerFrame since we will jump to a function that wants to save it 528 628 if ARM64 529 pop LRAndFP629 pop lr, cfr 530 630 elsif ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4 531 631 pop cfr … … 764 864 _llint_entry: 765 865 functionPrologue() 766 pushCalleeSaves 866 pushCalleeSaves() 767 867 initPCRelative(t1) 768 868 … … 770 870 include InitBytecodes 771 871 772 popCalleeSaves 872 popCalleeSaves() 773 873 functionEpilogue() 774 874 ret -
trunk/Source/JavaScriptCore/offlineasm/arm.rb
r167566 r172429 467 467 $asm.puts "push { #{op.armOperand} }" 468 468 } 469 when "popCalleeSaves"470 if isARMv7471 $asm.puts "pop {r4-r6, r8-r11}"472 else473 $asm.puts "pop {r4-r10}"474 end475 when "pushCalleeSaves"476 if isARMv7477 $asm.puts "push {r4-r6, r8-r11}"478 else479 $asm.puts "push {r4-r10}"480 end481 469 when "move" 482 470 if operands[0].immediate? -
trunk/Source/JavaScriptCore/offlineasm/arm64.rb
r167094 r172429 587 587 $asm.puts "stp #{ops[0].arm64Operand(:ptr)}, #{ops[1].arm64Operand(:ptr)}, [sp, #-16]!" 588 588 } 589 when "popLRAndFP"590 $asm.puts "ldp x29, x30, [sp], #16"591 when "pushLRAndFP"592 $asm.puts "stp x29, x30, [sp, #-16]!"593 when "popCalleeSaves"594 $asm.puts "ldp x28, x27, [sp], #16"595 $asm.puts "ldp x26, x25, [sp], #16"596 $asm.puts "ldp x24, x23, [sp], #16"597 $asm.puts "ldp x22, x21, [sp], #16"598 $asm.puts "ldp x20, x19, [sp], #16"599 when "pushCalleeSaves"600 $asm.puts "stp x20, x19, [sp, #-16]!"601 $asm.puts "stp x22, x21, [sp, #-16]!"602 $asm.puts "stp x24, x23, [sp, #-16]!"603 $asm.puts "stp x26, x25, [sp, #-16]!"604 $asm.puts "stp x28, x27, [sp, #-16]!"605 589 when "move" 606 590 if operands[0].immediate? -
trunk/Source/JavaScriptCore/offlineasm/ast.rb
r167094 r172429 581 581 end 582 582 583 class StringLiteral < NoChildren 584 attr_reader :value 585 586 def initialize(codeOrigin, value) 587 super(codeOrigin) 588 @value = value[1..-2] 589 raise "Bad string literal #{value.inspect} at #{codeOriginString}" unless value.is_a? String 590 end 591 592 def dump 593 "#{value}" 594 end 595 596 def ==(other) 597 other.is_a? StringLiteral and other.value == @value 598 end 599 600 def address? 601 false 602 end 603 604 def label? 605 false 606 end 607 608 def immediate? 609 false 610 end 611 612 def immediateOperand? 613 false 614 end 615 616 def register? 617 false 618 end 619 end 620 583 621 class RegisterID < NoChildren 584 622 attr_reader :name … … 890 928 when "globalAnnotation" 891 929 $asm.putGlobalAnnotation 930 when "emit" 931 $asm.puts "#{operands[0].dump}" 892 932 else 893 933 raise "Unhandled opcode #{opcode} at #{codeOriginString}" -
trunk/Source/JavaScriptCore/offlineasm/cloop.rb
r167094 r172429 1105 1105 } 1106 1106 1107 when "pushCalleeSaves"1108 when "popCalleeSaves"1109 1110 1107 1111 1108 # A convenience and compact call to crash because we don't want to use -
trunk/Source/JavaScriptCore/offlineasm/instructions.rb
r167566 r172429 31 31 MACRO_INSTRUCTIONS = 32 32 [ 33 "emit", 33 34 "addi", 34 35 "andi", … … 249 250 "leai", 250 251 "leap", 251 "pushCalleeSaves",252 "popCalleeSaves",253 252 "memfence" 254 253 ] … … 268 267 ARM64_INSTRUCTIONS = 269 268 [ 270 "pcrtoaddr", # Address from PC relative offset - adr instruction 271 "popLRAndFP", # ARM64 requires registers to be pushed and popped in pairs, 272 "pushLRAndFP" # therefore we do LR (link register) and FP (frame pointer) together. 269 "pcrtoaddr" # Address from PC relative offset - adr instruction 273 270 ] 274 271 -
trunk/Source/JavaScriptCore/offlineasm/mips.rb
r161377 r172429 851 851 $asm.puts "sw #{op.mipsOperand}, 0($sp)" 852 852 } 853 when "popCalleeSaves"854 $asm.puts "lw $16, 0($sp)"855 $asm.puts "lw $17, 4($sp)"856 $asm.puts "lw $18, 8($sp)"857 $asm.puts "lw $19, 12($sp)"858 $asm.puts "lw $20, 16($sp)"859 $asm.puts "addiu $sp, $sp, 20"860 when "pushCalleeSaves"861 $asm.puts "addiu $sp, $sp, -20"862 $asm.puts "sw $20, 16($sp)"863 $asm.puts "sw $19, 12($sp)"864 $asm.puts "sw $18, 8($sp)"865 $asm.puts "sw $17, 4($sp)"866 $asm.puts "sw $16, 0($sp)"867 853 when "move", "sxi2p", "zxi2p" 868 854 if operands[0].is_a? Immediate -
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r167094 r172429 166 166 when /\A[:,\(\)\[\]=\+\-~\|&^*]/ 167 167 result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) 168 when /\A".*"/ 169 result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) 168 170 else 169 171 raise "Lexer error at #{CodeOrigin.new(fileName, lineNumber).to_s}, unexpected sequence #{str[0..20].inspect}" … … 211 213 def isInteger(token) 212 214 token =~ /\A[0-9]/ 215 end 216 217 def isString(token) 218 token =~ /\A".*"/ 213 219 end 214 220 … … 398 404 @idx += 1 399 405 result 406 elsif isString @tokens[@idx] 407 result = StringLiteral.new(@tokens[@idx].codeOrigin, @tokens[@idx].string) 408 @idx += 1 409 result 400 410 elsif isIdentifier @tokens[@idx] 401 411 codeOrigin, names = parseColonColon … … 439 449 440 450 def couldBeExpression 441 @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or isInteger(@tokens[@idx]) or is Variable(@tokens[@idx]) or @tokens[@idx] == "("451 @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or @tokens[@idx] == "(" 442 452 end 443 453 -
trunk/Source/JavaScriptCore/offlineasm/sh4.rb
r167269 r172429 1092 1092 $asm.puts "mov.l #{sh4Operands(operands)}, @-r15" 1093 1093 end 1094 when "popCalleeSaves"1095 $asm.puts "mov.l @r15+, r8"1096 $asm.puts "mov.l @r15+, r9"1097 $asm.puts "mov.l @r15+, r10"1098 $asm.puts "mov.l @r15+, r11"1099 $asm.puts "mov.l @r15+, r13"1100 when "pushCalleeSaves"1101 $asm.puts "mov.l r13, @-r15"1102 $asm.puts "mov.l r11, @-r15"1103 $asm.puts "mov.l r10, @-r15"1104 $asm.puts "mov.l r9, @-r15"1105 $asm.puts "mov.l r8, @-r15"1106 1094 when "break" 1107 1095 # This special opcode always generates an illegal instruction exception. -
trunk/Source/JavaScriptCore/offlineasm/transform.rb
r167094 r172429 424 424 end 425 425 426 class StringLiteral 427 def validate 428 end 429 end 430 426 431 class RegisterID 427 432 def validate -
trunk/Source/JavaScriptCore/offlineasm/x86.rb
r170428 r172429 1147 1147 $asm.puts "push #{op.x86Operand(:ptr)}" 1148 1148 } 1149 when "popCalleeSaves"1150 if isX641151 if isMSVC1152 $asm.puts "pop " + register("rsi")1153 $asm.puts "pop " + register("rdi")1154 end1155 $asm.puts "pop " + register("rbx")1156 $asm.puts "pop " + register("r15")1157 $asm.puts "pop " + register("r14")1158 $asm.puts "pop " + register("r13")1159 $asm.puts "pop " + register("r12")1160 else1161 $asm.puts "pop " + register("ebx")1162 $asm.puts "pop " + register("edi")1163 $asm.puts "pop " + register("esi")1164 end1165 when "pushCalleeSaves"1166 if isX641167 $asm.puts "push " + register("r12")1168 $asm.puts "push " + register("r13")1169 $asm.puts "push " + register("r14")1170 $asm.puts "push " + register("r15")1171 $asm.puts "push " + register("rbx")1172 if isMSVC1173 $asm.puts "push " + register("rdi")1174 $asm.puts "push " + register("rsi")1175 end1176 else1177 $asm.puts "push " + register("esi")1178 $asm.puts "push " + register("edi")1179 $asm.puts "push " + register("ebx")1180 end1181 1149 when "move" 1182 1150 handleMove
Note: See TracChangeset
for help on using the changeset viewer.