OLD | NEW |
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 __ mov(r2, Operand(Smi::FromInt(length))); | 513 __ mov(r2, Operand(Smi::FromInt(length))); |
514 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 514 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
515 | 515 |
516 // If this block context is nested in the native context we get a smi | 516 // If this block context is nested in the native context we get a smi |
517 // sentinel instead of a function. The block context should get the | 517 // sentinel instead of a function. The block context should get the |
518 // canonical empty function of the native context as its closure which | 518 // canonical empty function of the native context as its closure which |
519 // we still have to look up. | 519 // we still have to look up. |
520 Label after_sentinel; | 520 Label after_sentinel; |
521 __ JumpIfNotSmi(r3, &after_sentinel); | 521 __ JumpIfNotSmi(r3, &after_sentinel); |
522 if (FLAG_debug_code) { | 522 if (FLAG_debug_code) { |
523 const char* message = "Expected 0 as a Smi sentinel"; | |
524 __ cmp(r3, Operand::Zero()); | 523 __ cmp(r3, Operand::Zero()); |
525 __ Assert(eq, message); | 524 __ Assert(eq, kExpected0AsASmiSentinel); |
526 } | 525 } |
527 __ ldr(r3, GlobalObjectOperand()); | 526 __ ldr(r3, GlobalObjectOperand()); |
528 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); | 527 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); |
529 __ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX)); | 528 __ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX)); |
530 __ bind(&after_sentinel); | 529 __ bind(&after_sentinel); |
531 | 530 |
532 // Set up the fixed slots, copy the global object from the previous context. | 531 // Set up the fixed slots, copy the global object from the previous context. |
533 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 532 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
534 __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX)); | 533 __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX)); |
535 __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX)); | 534 __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX)); |
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3910 // Check that the first argument is a JSRegExp object. | 3909 // Check that the first argument is a JSRegExp object. |
3911 __ ldr(r0, MemOperand(sp, kJSRegExpOffset)); | 3910 __ ldr(r0, MemOperand(sp, kJSRegExpOffset)); |
3912 __ JumpIfSmi(r0, &runtime); | 3911 __ JumpIfSmi(r0, &runtime); |
3913 __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE); | 3912 __ CompareObjectType(r0, r1, r1, JS_REGEXP_TYPE); |
3914 __ b(ne, &runtime); | 3913 __ b(ne, &runtime); |
3915 | 3914 |
3916 // Check that the RegExp has been compiled (data contains a fixed array). | 3915 // Check that the RegExp has been compiled (data contains a fixed array). |
3917 __ ldr(regexp_data, FieldMemOperand(r0, JSRegExp::kDataOffset)); | 3916 __ ldr(regexp_data, FieldMemOperand(r0, JSRegExp::kDataOffset)); |
3918 if (FLAG_debug_code) { | 3917 if (FLAG_debug_code) { |
3919 __ SmiTst(regexp_data); | 3918 __ SmiTst(regexp_data); |
3920 __ Check(ne, "Unexpected type for RegExp data, FixedArray expected"); | 3919 __ Check(ne, kUnexpectedTypeForRegExpDataFixedArrayExpected); |
3921 __ CompareObjectType(regexp_data, r0, r0, FIXED_ARRAY_TYPE); | 3920 __ CompareObjectType(regexp_data, r0, r0, FIXED_ARRAY_TYPE); |
3922 __ Check(eq, "Unexpected type for RegExp data, FixedArray expected"); | 3921 __ Check(eq, kUnexpectedTypeForRegExpDataFixedArrayExpected); |
3923 } | 3922 } |
3924 | 3923 |
3925 // regexp_data: RegExp data (FixedArray) | 3924 // regexp_data: RegExp data (FixedArray) |
3926 // Check the type of the RegExp. Only continue if type is JSRegExp::IRREGEXP. | 3925 // Check the type of the RegExp. Only continue if type is JSRegExp::IRREGEXP. |
3927 __ ldr(r0, FieldMemOperand(regexp_data, JSRegExp::kDataTagOffset)); | 3926 __ ldr(r0, FieldMemOperand(regexp_data, JSRegExp::kDataTagOffset)); |
3928 __ cmp(r0, Operand(Smi::FromInt(JSRegExp::IRREGEXP))); | 3927 __ cmp(r0, Operand(Smi::FromInt(JSRegExp::IRREGEXP))); |
3929 __ b(ne, &runtime); | 3928 __ b(ne, &runtime); |
3930 | 3929 |
3931 // regexp_data: RegExp data (FixedArray) | 3930 // regexp_data: RegExp data (FixedArray) |
3932 // Check that the number of captures fit in the static offsets vector buffer. | 3931 // Check that the number of captures fit in the static offsets vector buffer. |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4254 __ b(gt, ¬_long_external); // Go to (8). | 4253 __ b(gt, ¬_long_external); // Go to (8). |
4255 | 4254 |
4256 // (7) External string. Make it, offset-wise, look like a sequential string. | 4255 // (7) External string. Make it, offset-wise, look like a sequential string. |
4257 __ bind(&external_string); | 4256 __ bind(&external_string); |
4258 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 4257 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
4259 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 4258 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
4260 if (FLAG_debug_code) { | 4259 if (FLAG_debug_code) { |
4261 // Assert that we do not have a cons or slice (indirect strings) here. | 4260 // Assert that we do not have a cons or slice (indirect strings) here. |
4262 // Sequential strings have already been ruled out. | 4261 // Sequential strings have already been ruled out. |
4263 __ tst(r0, Operand(kIsIndirectStringMask)); | 4262 __ tst(r0, Operand(kIsIndirectStringMask)); |
4264 __ Assert(eq, "external string expected, but not found"); | 4263 __ Assert(eq, kExternalStringExpectedButNotFound); |
4265 } | 4264 } |
4266 __ ldr(subject, | 4265 __ ldr(subject, |
4267 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); | 4266 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); |
4268 // Move the pointer so that offset-wise, it looks like a sequential string. | 4267 // Move the pointer so that offset-wise, it looks like a sequential string. |
4269 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); | 4268 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); |
4270 __ sub(subject, | 4269 __ sub(subject, |
4271 subject, | 4270 subject, |
4272 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 4271 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
4273 __ jmp(&seq_string); // Go to (5). | 4272 __ jmp(&seq_string); // Go to (5). |
4274 | 4273 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4636 &call_runtime_); | 4635 &call_runtime_); |
4637 | 4636 |
4638 __ SmiTag(result_); | 4637 __ SmiTag(result_); |
4639 __ bind(&exit_); | 4638 __ bind(&exit_); |
4640 } | 4639 } |
4641 | 4640 |
4642 | 4641 |
4643 void StringCharCodeAtGenerator::GenerateSlow( | 4642 void StringCharCodeAtGenerator::GenerateSlow( |
4644 MacroAssembler* masm, | 4643 MacroAssembler* masm, |
4645 const RuntimeCallHelper& call_helper) { | 4644 const RuntimeCallHelper& call_helper) { |
4646 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 4645 __ Abort(kUnexpectedFallthroughToCharCodeAtSlowCase); |
4647 | 4646 |
4648 // Index is not a smi. | 4647 // Index is not a smi. |
4649 __ bind(&index_not_smi_); | 4648 __ bind(&index_not_smi_); |
4650 // If index is a heap number, try converting it to an integer. | 4649 // If index is a heap number, try converting it to an integer. |
4651 __ CheckMap(index_, | 4650 __ CheckMap(index_, |
4652 result_, | 4651 result_, |
4653 Heap::kHeapNumberMapRootIndex, | 4652 Heap::kHeapNumberMapRootIndex, |
4654 index_not_number_, | 4653 index_not_number_, |
4655 DONT_DO_SMI_CHECK); | 4654 DONT_DO_SMI_CHECK); |
4656 call_helper.BeforeCall(masm); | 4655 call_helper.BeforeCall(masm); |
(...skipping 24 matching lines...) Expand all Loading... |
4681 // is too complex (e.g., when the string needs to be flattened). | 4680 // is too complex (e.g., when the string needs to be flattened). |
4682 __ bind(&call_runtime_); | 4681 __ bind(&call_runtime_); |
4683 call_helper.BeforeCall(masm); | 4682 call_helper.BeforeCall(masm); |
4684 __ SmiTag(index_); | 4683 __ SmiTag(index_); |
4685 __ Push(object_, index_); | 4684 __ Push(object_, index_); |
4686 __ CallRuntime(Runtime::kStringCharCodeAt, 2); | 4685 __ CallRuntime(Runtime::kStringCharCodeAt, 2); |
4687 __ Move(result_, r0); | 4686 __ Move(result_, r0); |
4688 call_helper.AfterCall(masm); | 4687 call_helper.AfterCall(masm); |
4689 __ jmp(&exit_); | 4688 __ jmp(&exit_); |
4690 | 4689 |
4691 __ Abort("Unexpected fallthrough from CharCodeAt slow case"); | 4690 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
4692 } | 4691 } |
4693 | 4692 |
4694 | 4693 |
4695 // ------------------------------------------------------------------------- | 4694 // ------------------------------------------------------------------------- |
4696 // StringCharFromCodeGenerator | 4695 // StringCharFromCodeGenerator |
4697 | 4696 |
4698 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | 4697 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { |
4699 // Fast case of Heap::LookupSingleCharacterStringFromCode. | 4698 // Fast case of Heap::LookupSingleCharacterStringFromCode. |
4700 STATIC_ASSERT(kSmiTag == 0); | 4699 STATIC_ASSERT(kSmiTag == 0); |
4701 STATIC_ASSERT(kSmiShiftSize == 0); | 4700 STATIC_ASSERT(kSmiShiftSize == 0); |
4702 ASSERT(IsPowerOf2(String::kMaxOneByteCharCode + 1)); | 4701 ASSERT(IsPowerOf2(String::kMaxOneByteCharCode + 1)); |
4703 __ tst(code_, | 4702 __ tst(code_, |
4704 Operand(kSmiTagMask | | 4703 Operand(kSmiTagMask | |
4705 ((~String::kMaxOneByteCharCode) << kSmiTagSize))); | 4704 ((~String::kMaxOneByteCharCode) << kSmiTagSize))); |
4706 __ b(ne, &slow_case_); | 4705 __ b(ne, &slow_case_); |
4707 | 4706 |
4708 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | 4707 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); |
4709 // At this point code register contains smi tagged ASCII char code. | 4708 // At this point code register contains smi tagged ASCII char code. |
4710 __ add(result_, result_, Operand::PointerOffsetFromSmiKey(code_)); | 4709 __ add(result_, result_, Operand::PointerOffsetFromSmiKey(code_)); |
4711 __ ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | 4710 __ ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); |
4712 __ CompareRoot(result_, Heap::kUndefinedValueRootIndex); | 4711 __ CompareRoot(result_, Heap::kUndefinedValueRootIndex); |
4713 __ b(eq, &slow_case_); | 4712 __ b(eq, &slow_case_); |
4714 __ bind(&exit_); | 4713 __ bind(&exit_); |
4715 } | 4714 } |
4716 | 4715 |
4717 | 4716 |
4718 void StringCharFromCodeGenerator::GenerateSlow( | 4717 void StringCharFromCodeGenerator::GenerateSlow( |
4719 MacroAssembler* masm, | 4718 MacroAssembler* masm, |
4720 const RuntimeCallHelper& call_helper) { | 4719 const RuntimeCallHelper& call_helper) { |
4721 __ Abort("Unexpected fallthrough to CharFromCode slow case"); | 4720 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); |
4722 | 4721 |
4723 __ bind(&slow_case_); | 4722 __ bind(&slow_case_); |
4724 call_helper.BeforeCall(masm); | 4723 call_helper.BeforeCall(masm); |
4725 __ push(code_); | 4724 __ push(code_); |
4726 __ CallRuntime(Runtime::kCharFromCode, 1); | 4725 __ CallRuntime(Runtime::kCharFromCode, 1); |
4727 __ Move(result_, r0); | 4726 __ Move(result_, r0); |
4728 call_helper.AfterCall(masm); | 4727 call_helper.AfterCall(masm); |
4729 __ jmp(&exit_); | 4728 __ jmp(&exit_); |
4730 | 4729 |
4731 __ Abort("Unexpected fallthrough from CharFromCode slow case"); | 4730 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
4732 } | 4731 } |
4733 | 4732 |
4734 | 4733 |
4735 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | 4734 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, |
4736 Register dest, | 4735 Register dest, |
4737 Register src, | 4736 Register src, |
4738 Register count, | 4737 Register count, |
4739 Register scratch, | 4738 Register scratch, |
4740 bool ascii) { | 4739 bool ascii) { |
4741 Label loop; | 4740 Label loop; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4778 Register scratch4, | 4777 Register scratch4, |
4779 Register scratch5, | 4778 Register scratch5, |
4780 int flags) { | 4779 int flags) { |
4781 bool ascii = (flags & COPY_ASCII) != 0; | 4780 bool ascii = (flags & COPY_ASCII) != 0; |
4782 bool dest_always_aligned = (flags & DEST_ALWAYS_ALIGNED) != 0; | 4781 bool dest_always_aligned = (flags & DEST_ALWAYS_ALIGNED) != 0; |
4783 | 4782 |
4784 if (dest_always_aligned && FLAG_debug_code) { | 4783 if (dest_always_aligned && FLAG_debug_code) { |
4785 // Check that destination is actually word aligned if the flag says | 4784 // Check that destination is actually word aligned if the flag says |
4786 // that it is. | 4785 // that it is. |
4787 __ tst(dest, Operand(kPointerAlignmentMask)); | 4786 __ tst(dest, Operand(kPointerAlignmentMask)); |
4788 __ Check(eq, "Destination of copy not aligned."); | 4787 __ Check(eq, kDestinationOfCopyNotAligned); |
4789 } | 4788 } |
4790 | 4789 |
4791 const int kReadAlignment = 4; | 4790 const int kReadAlignment = 4; |
4792 const int kReadAlignmentMask = kReadAlignment - 1; | 4791 const int kReadAlignmentMask = kReadAlignment - 1; |
4793 // Ensure that reading an entire aligned word containing the last character | 4792 // Ensure that reading an entire aligned word containing the last character |
4794 // of a string will not read outside the allocated area (because we pad up | 4793 // of a string will not read outside the allocated area (because we pad up |
4795 // to kObjectAlignment). | 4794 // to kObjectAlignment). |
4796 STATIC_ASSERT(kObjectAlignment >= kReadAlignment); | 4795 STATIC_ASSERT(kObjectAlignment >= kReadAlignment); |
4797 // Assumes word reads and writes are little endian. | 4796 // Assumes word reads and writes are little endian. |
4798 // Nothing to do for zero characters. | 4797 // Nothing to do for zero characters. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5007 Label is_string; | 5006 Label is_string; |
5008 __ CompareObjectType(candidate, scratch, scratch, ODDBALL_TYPE); | 5007 __ CompareObjectType(candidate, scratch, scratch, ODDBALL_TYPE); |
5009 __ b(ne, &is_string); | 5008 __ b(ne, &is_string); |
5010 | 5009 |
5011 __ cmp(undefined, candidate); | 5010 __ cmp(undefined, candidate); |
5012 __ b(eq, not_found); | 5011 __ b(eq, not_found); |
5013 // Must be the hole (deleted entry). | 5012 // Must be the hole (deleted entry). |
5014 if (FLAG_debug_code) { | 5013 if (FLAG_debug_code) { |
5015 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 5014 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
5016 __ cmp(ip, candidate); | 5015 __ cmp(ip, candidate); |
5017 __ Assert(eq, "oddball in string table is not undefined or the hole"); | 5016 __ Assert(eq, kOddballInStringTableIsNotUndefinedOrTheHole); |
5018 } | 5017 } |
5019 __ jmp(&next_probe[i]); | 5018 __ jmp(&next_probe[i]); |
5020 | 5019 |
5021 __ bind(&is_string); | 5020 __ bind(&is_string); |
5022 | 5021 |
5023 // Check that the candidate is a non-external ASCII string. The instance | 5022 // Check that the candidate is a non-external ASCII string. The instance |
5024 // type is still in the scratch register from the CompareObjectType | 5023 // type is still in the scratch register from the CompareObjectType |
5025 // operation. | 5024 // operation. |
5026 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch, scratch, &next_probe[i]); | 5025 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch, scratch, &next_probe[i]); |
5027 | 5026 |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6905 Label next; | 6904 Label next; |
6906 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6905 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
6907 __ cmp(r3, Operand(kind)); | 6906 __ cmp(r3, Operand(kind)); |
6908 __ b(ne, &next); | 6907 __ b(ne, &next); |
6909 T stub(kind); | 6908 T stub(kind); |
6910 __ TailCallStub(&stub); | 6909 __ TailCallStub(&stub); |
6911 __ bind(&next); | 6910 __ bind(&next); |
6912 } | 6911 } |
6913 | 6912 |
6914 // If we reached this point there is a problem. | 6913 // If we reached this point there is a problem. |
6915 __ Abort("Unexpected ElementsKind in array constructor"); | 6914 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
6916 } | 6915 } |
6917 | 6916 |
6918 | 6917 |
6919 static void CreateArrayDispatchOneArgument(MacroAssembler* masm) { | 6918 static void CreateArrayDispatchOneArgument(MacroAssembler* masm) { |
6920 // r2 - type info cell | 6919 // r2 - type info cell |
6921 // r3 - kind | 6920 // r3 - kind |
6922 // r0 - number of arguments | 6921 // r0 - number of arguments |
6923 // r1 - constructor? | 6922 // r1 - constructor? |
6924 // sp[0] - last argument | 6923 // sp[0] - last argument |
6925 ASSERT(FAST_SMI_ELEMENTS == 0); | 6924 ASSERT(FAST_SMI_ELEMENTS == 0); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6962 Label next; | 6961 Label next; |
6963 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6962 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
6964 __ cmp(r3, Operand(kind)); | 6963 __ cmp(r3, Operand(kind)); |
6965 __ b(ne, &next); | 6964 __ b(ne, &next); |
6966 ArraySingleArgumentConstructorStub stub(kind); | 6965 ArraySingleArgumentConstructorStub stub(kind); |
6967 __ TailCallStub(&stub); | 6966 __ TailCallStub(&stub); |
6968 __ bind(&next); | 6967 __ bind(&next); |
6969 } | 6968 } |
6970 | 6969 |
6971 // If we reached this point there is a problem. | 6970 // If we reached this point there is a problem. |
6972 __ Abort("Unexpected ElementsKind in array constructor"); | 6971 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
6973 } | 6972 } |
6974 | 6973 |
6975 | 6974 |
6976 template<class T> | 6975 template<class T> |
6977 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { | 6976 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { |
6978 int to_index = GetSequenceIndexFromFastElementsKind( | 6977 int to_index = GetSequenceIndexFromFastElementsKind( |
6979 TERMINAL_FAST_ELEMENTS_KIND); | 6978 TERMINAL_FAST_ELEMENTS_KIND); |
6980 for (int i = 0; i <= to_index; ++i) { | 6979 for (int i = 0; i <= to_index; ++i) { |
6981 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6980 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
6982 T stub(kind); | 6981 T stub(kind); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7023 // -- sp[4] : last argument | 7022 // -- sp[4] : last argument |
7024 // ----------------------------------- | 7023 // ----------------------------------- |
7025 if (FLAG_debug_code) { | 7024 if (FLAG_debug_code) { |
7026 // The array construct code is only set for the global and natives | 7025 // The array construct code is only set for the global and natives |
7027 // builtin Array functions which always have maps. | 7026 // builtin Array functions which always have maps. |
7028 | 7027 |
7029 // Initial map for the builtin Array function should be a map. | 7028 // Initial map for the builtin Array function should be a map. |
7030 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 7029 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
7031 // Will both indicate a NULL and a Smi. | 7030 // Will both indicate a NULL and a Smi. |
7032 __ tst(r3, Operand(kSmiTagMask)); | 7031 __ tst(r3, Operand(kSmiTagMask)); |
7033 __ Assert(ne, "Unexpected initial map for Array function"); | 7032 __ Assert(ne, kUnexpectedInitialMapForArrayFunction); |
7034 __ CompareObjectType(r3, r3, r4, MAP_TYPE); | 7033 __ CompareObjectType(r3, r3, r4, MAP_TYPE); |
7035 __ Assert(eq, "Unexpected initial map for Array function"); | 7034 __ Assert(eq, kUnexpectedInitialMapForArrayFunction); |
7036 | 7035 |
7037 // We should either have undefined in ebx or a valid cell | 7036 // We should either have undefined in ebx or a valid cell |
7038 Label okay_here; | 7037 Label okay_here; |
7039 Handle<Map> cell_map = masm->isolate()->factory()->cell_map(); | 7038 Handle<Map> cell_map = masm->isolate()->factory()->cell_map(); |
7040 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); | 7039 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
7041 __ b(eq, &okay_here); | 7040 __ b(eq, &okay_here); |
7042 __ ldr(r3, FieldMemOperand(r2, 0)); | 7041 __ ldr(r3, FieldMemOperand(r2, 0)); |
7043 __ cmp(r3, Operand(cell_map)); | 7042 __ cmp(r3, Operand(cell_map)); |
7044 __ Assert(eq, "Expected property cell in register ebx"); | 7043 __ Assert(eq, kExpectedPropertyCellInRegisterEbx); |
7045 __ bind(&okay_here); | 7044 __ bind(&okay_here); |
7046 } | 7045 } |
7047 | 7046 |
7048 Label no_info, switch_ready; | 7047 Label no_info, switch_ready; |
7049 // Get the elements kind and case on that. | 7048 // Get the elements kind and case on that. |
7050 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); | 7049 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
7051 __ b(eq, &no_info); | 7050 __ b(eq, &no_info); |
7052 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); | 7051 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
7053 | 7052 |
7054 // The type cell may have undefined in its value. | 7053 // The type cell may have undefined in its value. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7137 // ----------------------------------- | 7136 // ----------------------------------- |
7138 | 7137 |
7139 if (FLAG_debug_code) { | 7138 if (FLAG_debug_code) { |
7140 // The array construct code is only set for the global and natives | 7139 // The array construct code is only set for the global and natives |
7141 // builtin Array functions which always have maps. | 7140 // builtin Array functions which always have maps. |
7142 | 7141 |
7143 // Initial map for the builtin Array function should be a map. | 7142 // Initial map for the builtin Array function should be a map. |
7144 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 7143 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
7145 // Will both indicate a NULL and a Smi. | 7144 // Will both indicate a NULL and a Smi. |
7146 __ tst(r3, Operand(kSmiTagMask)); | 7145 __ tst(r3, Operand(kSmiTagMask)); |
7147 __ Assert(ne, "Unexpected initial map for Array function"); | 7146 __ Assert(ne, kUnexpectedInitialMapForArrayFunction); |
7148 __ CompareObjectType(r3, r3, r4, MAP_TYPE); | 7147 __ CompareObjectType(r3, r3, r4, MAP_TYPE); |
7149 __ Assert(eq, "Unexpected initial map for Array function"); | 7148 __ Assert(eq, kUnexpectedInitialMapForArrayFunction); |
7150 } | 7149 } |
7151 | 7150 |
7152 // Figure out the right elements kind | 7151 // Figure out the right elements kind |
7153 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 7152 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
7154 // Load the map's "bit field 2" into |result|. We only need the first byte, | 7153 // Load the map's "bit field 2" into |result|. We only need the first byte, |
7155 // but the following bit field extraction takes care of that anyway. | 7154 // but the following bit field extraction takes care of that anyway. |
7156 __ ldr(r3, FieldMemOperand(r3, Map::kBitField2Offset)); | 7155 __ ldr(r3, FieldMemOperand(r3, Map::kBitField2Offset)); |
7157 // Retrieve elements_kind from bit field 2. | 7156 // Retrieve elements_kind from bit field 2. |
7158 __ Ubfx(r3, r3, Map::kElementsKindShift, Map::kElementsKindBitCount); | 7157 __ Ubfx(r3, r3, Map::kElementsKindShift, Map::kElementsKindBitCount); |
7159 | 7158 |
7160 if (FLAG_debug_code) { | 7159 if (FLAG_debug_code) { |
7161 Label done; | 7160 Label done; |
7162 __ cmp(r3, Operand(FAST_ELEMENTS)); | 7161 __ cmp(r3, Operand(FAST_ELEMENTS)); |
7163 __ b(eq, &done); | 7162 __ b(eq, &done); |
7164 __ cmp(r3, Operand(FAST_HOLEY_ELEMENTS)); | 7163 __ cmp(r3, Operand(FAST_HOLEY_ELEMENTS)); |
7165 __ Assert(eq, | 7164 __ Assert(eq, |
7166 "Invalid ElementsKind for InternalArray or InternalPackedArray"); | 7165 kInvalidElementsKindForInternalArrayOrInternalPackedArray); |
7167 __ bind(&done); | 7166 __ bind(&done); |
7168 } | 7167 } |
7169 | 7168 |
7170 Label fast_elements_case; | 7169 Label fast_elements_case; |
7171 __ cmp(r3, Operand(FAST_ELEMENTS)); | 7170 __ cmp(r3, Operand(FAST_ELEMENTS)); |
7172 __ b(eq, &fast_elements_case); | 7171 __ b(eq, &fast_elements_case); |
7173 GenerateCase(masm, FAST_HOLEY_ELEMENTS); | 7172 GenerateCase(masm, FAST_HOLEY_ELEMENTS); |
7174 | 7173 |
7175 __ bind(&fast_elements_case); | 7174 __ bind(&fast_elements_case); |
7176 GenerateCase(masm, FAST_ELEMENTS); | 7175 GenerateCase(masm, FAST_ELEMENTS); |
7177 } | 7176 } |
7178 | 7177 |
7179 | 7178 |
7180 #undef __ | 7179 #undef __ |
7181 | 7180 |
7182 } } // namespace v8::internal | 7181 } } // namespace v8::internal |
7183 | 7182 |
7184 #endif // V8_TARGET_ARCH_ARM | 7183 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |