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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6682025: Crankshaft support for StringCharFromCode. (Closed)
Patch Set: Ports Created 9 years, 9 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/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); 3091 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex);
3092 if (FLAG_debug_code) { 3092 if (FLAG_debug_code) {
3093 __ AbortIfNotSmi(r0); 3093 __ AbortIfNotSmi(r0);
3094 } 3094 }
3095 __ SmiUntag(r0); 3095 __ SmiUntag(r0);
3096 __ StoreToSafepointRegisterSlot(r0, result); 3096 __ StoreToSafepointRegisterSlot(r0, result);
3097 __ PopSafepointRegisters(); 3097 __ PopSafepointRegisters();
3098 } 3098 }
3099 3099
3100 3100
3101 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) {
3102 class DeferredStringCharFromCode: public LDeferredCode {
3103 public:
3104 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr)
3105 : LDeferredCode(codegen), instr_(instr) { }
3106 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); }
3107 private:
3108 LStringCharFromCode* instr_;
3109 };
3110
3111 DeferredStringCharFromCode* deferred =
3112 new DeferredStringCharFromCode(this, instr);
3113
3114 ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
3115 Register char_code = ToRegister(instr->char_code());
3116 Register result = ToRegister(instr->result());
3117 ASSERT(!char_code.is(result));
3118
3119 __ cmp(char_code, Operand(String::kMaxAsciiCharCode));
3120 __ b(hi, deferred->entry());
3121 __ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex);
3122 __ add(result, result, Operand(char_code, LSL, kPointerSizeLog2));
3123 __ ldr(result, FieldMemOperand(result, FixedArray::kHeaderSize));
3124 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3125 __ cmp(result, ip);
3126 __ b(eq, deferred->entry());
3127 __ bind(deferred->exit());
3128 }
3129
3130
3131 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) {
3132 Register char_code = ToRegister(instr->char_code());
3133 Register result = ToRegister(instr->result());
3134
3135 // TODO(3095996): Get rid of this. For now, we need to make the
3136 // result register contain a valid pointer because it is already
3137 // contained in the register pointer map.
3138 __ mov(result, Operand(0));
3139
3140 __ PushSafepointRegisters();
3141 __ SmiTag(char_code);
3142 __ push(char_code);
3143 __ CallRuntimeSaveDoubles(Runtime::kCharFromCode);
3144 RecordSafepointWithRegisters(
3145 instr->pointer_map(), 1, Safepoint::kNoDeoptimizationIndex);
3146 __ StoreToSafepointRegisterSlot(r0, result);
3147 __ PopSafepointRegisters();
3148 }
3149
3150
3101 void LCodeGen::DoStringLength(LStringLength* instr) { 3151 void LCodeGen::DoStringLength(LStringLength* instr) {
3102 Register string = ToRegister(instr->InputAt(0)); 3152 Register string = ToRegister(instr->InputAt(0));
3103 Register result = ToRegister(instr->result()); 3153 Register result = ToRegister(instr->result());
3104 __ ldr(result, FieldMemOperand(string, String::kLengthOffset)); 3154 __ ldr(result, FieldMemOperand(string, String::kLengthOffset));
3105 } 3155 }
3106 3156
3107 3157
3108 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { 3158 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
3109 LOperand* input = instr->InputAt(0); 3159 LOperand* input = instr->InputAt(0);
3110 ASSERT(input->IsRegister() || input->IsStackSlot()); 3160 ASSERT(input->IsRegister() || input->IsStackSlot());
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
3877 ASSERT(!environment->HasBeenRegistered()); 3927 ASSERT(!environment->HasBeenRegistered());
3878 RegisterEnvironmentForDeoptimization(environment); 3928 RegisterEnvironmentForDeoptimization(environment);
3879 ASSERT(osr_pc_offset_ == -1); 3929 ASSERT(osr_pc_offset_ == -1);
3880 osr_pc_offset_ = masm()->pc_offset(); 3930 osr_pc_offset_ = masm()->pc_offset();
3881 } 3931 }
3882 3932
3883 3933
3884 #undef __ 3934 #undef __
3885 3935
3886 } } // namespace v8::internal 3936 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698