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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 149413010: A64: Synchronize with r16024. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/frames-mips.h ('k') | src/mips/lithium-codegen-mips.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 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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 779
780 780
781 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { 781 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
782 // The variable in the declaration always resides in the current function 782 // The variable in the declaration always resides in the current function
783 // context. 783 // context.
784 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); 784 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope()));
785 if (generate_debug_code_) { 785 if (generate_debug_code_) {
786 // Check that we're not inside a with or catch context. 786 // Check that we're not inside a with or catch context.
787 __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); 787 __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset));
788 __ LoadRoot(t0, Heap::kWithContextMapRootIndex); 788 __ LoadRoot(t0, Heap::kWithContextMapRootIndex);
789 __ Check(ne, "Declaration in with context.", 789 __ Check(ne, kDeclarationInWithContext,
790 a1, Operand(t0)); 790 a1, Operand(t0));
791 __ LoadRoot(t0, Heap::kCatchContextMapRootIndex); 791 __ LoadRoot(t0, Heap::kCatchContextMapRootIndex);
792 __ Check(ne, "Declaration in catch context.", 792 __ Check(ne, kDeclarationInCatchContext,
793 a1, Operand(t0)); 793 a1, Operand(t0));
794 } 794 }
795 } 795 }
796 796
797 797
798 void FullCodeGenerator::VisitVariableDeclaration( 798 void FullCodeGenerator::VisitVariableDeclaration(
799 VariableDeclaration* declaration) { 799 VariableDeclaration* declaration) {
800 // If it was not possible to allocate the variable at compile time, we 800 // If it was not possible to allocate the variable at compile time, we
801 // need to "declare" it at runtime to make sure it actually exists in the 801 // need to "declare" it at runtime to make sure it actually exists in the
802 // local context. 802 // local context.
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 context()->Plug(result_register()); 2227 context()->Plug(result_register());
2228 } 2228 }
2229 2229
2230 2230
2231 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { 2231 void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
2232 Label gc_required; 2232 Label gc_required;
2233 Label allocated; 2233 Label allocated;
2234 2234
2235 Handle<Map> map(isolate()->native_context()->generator_result_map()); 2235 Handle<Map> map(isolate()->native_context()->generator_result_map());
2236 2236
2237 __ Allocate(map->instance_size(), a0, a2, a3, &gc_required, TAG_OBJECT); 2237 __ Allocate(map->instance_size(), v0, a2, a3, &gc_required, TAG_OBJECT);
2238 __ jmp(&allocated); 2238 __ jmp(&allocated);
2239 2239
2240 __ bind(&gc_required); 2240 __ bind(&gc_required);
2241 __ Push(Smi::FromInt(map->instance_size())); 2241 __ Push(Smi::FromInt(map->instance_size()));
2242 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); 2242 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2243 __ lw(context_register(), 2243 __ lw(context_register(),
2244 MemOperand(fp, StandardFrameConstants::kContextOffset)); 2244 MemOperand(fp, StandardFrameConstants::kContextOffset));
2245 2245
2246 __ bind(&allocated); 2246 __ bind(&allocated);
2247 __ li(a1, Operand(map)); 2247 __ li(a1, Operand(map));
2248 __ pop(a2); 2248 __ pop(a2);
2249 __ li(a3, Operand(isolate()->factory()->ToBoolean(done))); 2249 __ li(a3, Operand(isolate()->factory()->ToBoolean(done)));
2250 __ li(t0, Operand(isolate()->factory()->empty_fixed_array())); 2250 __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
2251 ASSERT_EQ(map->instance_size(), 5 * kPointerSize); 2251 ASSERT_EQ(map->instance_size(), 5 * kPointerSize);
2252 __ sw(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); 2252 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
2253 __ sw(t0, FieldMemOperand(a0, JSObject::kPropertiesOffset)); 2253 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
2254 __ sw(t0, FieldMemOperand(a0, JSObject::kElementsOffset)); 2254 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
2255 __ sw(a2, 2255 __ sw(a2,
2256 FieldMemOperand(a0, JSGeneratorObject::kResultValuePropertyOffset)); 2256 FieldMemOperand(v0, JSGeneratorObject::kResultValuePropertyOffset));
2257 __ sw(a3, 2257 __ sw(a3,
2258 FieldMemOperand(a0, JSGeneratorObject::kResultDonePropertyOffset)); 2258 FieldMemOperand(v0, JSGeneratorObject::kResultDonePropertyOffset));
2259 2259
2260 // Only the value field needs a write barrier, as the other values are in the 2260 // Only the value field needs a write barrier, as the other values are in the
2261 // root set. 2261 // root set.
2262 __ RecordWriteField(a0, JSGeneratorObject::kResultValuePropertyOffset, 2262 __ RecordWriteField(v0, JSGeneratorObject::kResultValuePropertyOffset,
2263 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); 2263 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs);
2264 __ mov(result_register(), a0);
2265 } 2264 }
2266 2265
2267 2266
2268 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2267 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2269 SetSourcePosition(prop->position()); 2268 SetSourcePosition(prop->position());
2270 Literal* key = prop->key()->AsLiteral(); 2269 Literal* key = prop->key()->AsLiteral();
2271 __ mov(a0, result_register()); 2270 __ mov(a0, result_register());
2272 __ li(a2, Operand(key->value())); 2271 __ li(a2, Operand(key->value()));
2273 // Call load IC. It has arguments receiver and property name a0 and a2. 2272 // Call load IC. It has arguments receiver and property name a0 and a2.
2274 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2273 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 2522
2524 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { 2523 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) {
2525 // Assignment to var or initializing assignment to let/const 2524 // Assignment to var or initializing assignment to let/const
2526 // in harmony mode. 2525 // in harmony mode.
2527 if (var->IsStackAllocated() || var->IsContextSlot()) { 2526 if (var->IsStackAllocated() || var->IsContextSlot()) {
2528 MemOperand location = VarOperand(var, a1); 2527 MemOperand location = VarOperand(var, a1);
2529 if (generate_debug_code_ && op == Token::INIT_LET) { 2528 if (generate_debug_code_ && op == Token::INIT_LET) {
2530 // Check for an uninitialized let binding. 2529 // Check for an uninitialized let binding.
2531 __ lw(a2, location); 2530 __ lw(a2, location);
2532 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2531 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2533 __ Check(eq, "Let binding re-initialization.", a2, Operand(t0)); 2532 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0));
2534 } 2533 }
2535 // Perform the assignment. 2534 // Perform the assignment.
2536 __ sw(v0, location); 2535 __ sw(v0, location);
2537 if (var->IsContextSlot()) { 2536 if (var->IsContextSlot()) {
2538 __ mov(a3, v0); 2537 __ mov(a3, v0);
2539 int offset = Context::SlotOffset(var->index()); 2538 int offset = Context::SlotOffset(var->index());
2540 __ RecordWriteContextSlot( 2539 __ RecordWriteContextSlot(
2541 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); 2540 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs);
2542 } 2541 }
2543 } else { 2542 } else {
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
3486 __ bind(&done); 3485 __ bind(&done);
3487 context()->Plug(v0); 3486 context()->Plug(v0);
3488 } 3487 }
3489 3488
3490 3489
3491 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string, 3490 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string,
3492 Register index, 3491 Register index,
3493 Register value, 3492 Register value,
3494 uint32_t encoding_mask) { 3493 uint32_t encoding_mask) {
3495 __ And(at, index, Operand(kSmiTagMask)); 3494 __ And(at, index, Operand(kSmiTagMask));
3496 __ Check(eq, "Non-smi index", at, Operand(zero_reg)); 3495 __ Check(eq, kNonSmiIndex, at, Operand(zero_reg));
3497 __ And(at, value, Operand(kSmiTagMask)); 3496 __ And(at, value, Operand(kSmiTagMask));
3498 __ Check(eq, "Non-smi value", at, Operand(zero_reg)); 3497 __ Check(eq, kNonSmiValue, at, Operand(zero_reg));
3499 3498
3500 __ lw(at, FieldMemOperand(string, String::kLengthOffset)); 3499 __ lw(at, FieldMemOperand(string, String::kLengthOffset));
3501 __ Check(lt, "Index is too large", index, Operand(at)); 3500 __ Check(lt, kIndexIsTooLarge, index, Operand(at));
3502 3501
3503 __ Check(ge, "Index is negative", index, Operand(zero_reg)); 3502 __ Check(ge, kIndexIsNegative, index, Operand(zero_reg));
3504 3503
3505 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); 3504 __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset));
3506 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); 3505 __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset));
3507 3506
3508 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); 3507 __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask));
3509 __ Subu(at, at, Operand(encoding_mask)); 3508 __ Subu(at, at, Operand(encoding_mask));
3510 __ Check(eq, "Unexpected string type", at, Operand(zero_reg)); 3509 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg));
3511 } 3510 }
3512 3511
3513 3512
3514 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3513 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3515 ZoneList<Expression*>* args = expr->arguments(); 3514 ZoneList<Expression*>* args = expr->arguments();
3516 ASSERT_EQ(3, args->length()); 3515 ASSERT_EQ(3, args->length());
3517 3516
3518 Register string = v0; 3517 Register string = v0;
3519 Register index = a1; 3518 Register index = a1;
3520 Register value = a2; 3519 Register value = a2;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3875 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { 3874 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
3876 ZoneList<Expression*>* args = expr->arguments(); 3875 ZoneList<Expression*>* args = expr->arguments();
3877 ASSERT_EQ(2, args->length()); 3876 ASSERT_EQ(2, args->length());
3878 3877
3879 ASSERT_NE(NULL, args->at(0)->AsLiteral()); 3878 ASSERT_NE(NULL, args->at(0)->AsLiteral());
3880 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); 3879 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
3881 3880
3882 Handle<FixedArray> jsfunction_result_caches( 3881 Handle<FixedArray> jsfunction_result_caches(
3883 isolate()->native_context()->jsfunction_result_caches()); 3882 isolate()->native_context()->jsfunction_result_caches());
3884 if (jsfunction_result_caches->length() <= cache_id) { 3883 if (jsfunction_result_caches->length() <= cache_id) {
3885 __ Abort("Attempt to use undefined cache."); 3884 __ Abort(kAttemptToUseUndefinedCache);
3886 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 3885 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
3887 context()->Plug(v0); 3886 context()->Plug(v0);
3888 return; 3887 return;
3889 } 3888 }
3890 3889
3891 VisitForAccumulatorValue(args->at(1)); 3890 VisitForAccumulatorValue(args->at(1));
3892 3891
3893 Register key = v0; 3892 Register key = v0;
3894 Register cache = a1; 3893 Register cache = a1;
3895 __ lw(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 3894 __ lw(cache, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 __ Addu(elements_end, element, elements_end); 4056 __ Addu(elements_end, element, elements_end);
4058 // Loop condition: while (element < elements_end). 4057 // Loop condition: while (element < elements_end).
4059 // Live values in registers: 4058 // Live values in registers:
4060 // elements: Fixed array of strings. 4059 // elements: Fixed array of strings.
4061 // array_length: Length of the fixed array of strings (not smi) 4060 // array_length: Length of the fixed array of strings (not smi)
4062 // separator: Separator string 4061 // separator: Separator string
4063 // string_length: Accumulated sum of string lengths (smi). 4062 // string_length: Accumulated sum of string lengths (smi).
4064 // element: Current array element. 4063 // element: Current array element.
4065 // elements_end: Array end. 4064 // elements_end: Array end.
4066 if (generate_debug_code_) { 4065 if (generate_debug_code_) {
4067 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin", 4066 __ Assert(gt, kNoEmptyArraysHereInEmitFastAsciiArrayJoin,
4068 array_length, Operand(zero_reg)); 4067 array_length, Operand(zero_reg));
4069 } 4068 }
4070 __ bind(&loop); 4069 __ bind(&loop);
4071 __ lw(string, MemOperand(element)); 4070 __ lw(string, MemOperand(element));
4072 __ Addu(element, element, kPointerSize); 4071 __ Addu(element, element, kPointerSize);
4073 __ JumpIfSmi(string, &bailout); 4072 __ JumpIfSmi(string, &bailout);
4074 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); 4073 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset));
4075 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); 4074 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset));
4076 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); 4075 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout);
4077 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset)); 4076 __ lw(scratch1, FieldMemOperand(string, SeqOneByteString::kLengthOffset));
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
4948 *context_length = 0; 4947 *context_length = 0;
4949 return previous_; 4948 return previous_;
4950 } 4949 }
4951 4950
4952 4951
4953 #undef __ 4952 #undef __
4954 4953
4955 } } // namespace v8::internal 4954 } } // namespace v8::internal
4956 4955
4957 #endif // V8_TARGET_ARCH_MIPS 4956 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/frames-mips.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698