OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "bootstrapper.h" | 30 #include "bootstrapper.h" |
31 #include "codegen-inl.h" | 31 #include "codegen-inl.h" |
32 #include "debug.h" | 32 #include "debug.h" |
| 33 #include "parser.h" |
33 #include "register-allocator-inl.h" | 34 #include "register-allocator-inl.h" |
34 #include "runtime.h" | 35 #include "runtime.h" |
35 #include "scopes.h" | 36 #include "scopes.h" |
36 | 37 |
37 | 38 |
38 namespace v8 { namespace internal { | 39 namespace v8 { namespace internal { |
39 | 40 |
40 #define __ masm_-> | 41 #define __ masm_-> |
41 | 42 |
42 // ------------------------------------------------------------------------- | 43 // ------------------------------------------------------------------------- |
(...skipping 2702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 // r0: cloned object literal | 2746 // r0: cloned object literal |
2746 | 2747 |
2747 for (int i = 0; i < node->properties()->length(); i++) { | 2748 for (int i = 0; i < node->properties()->length(); i++) { |
2748 ObjectLiteral::Property* property = node->properties()->at(i); | 2749 ObjectLiteral::Property* property = node->properties()->at(i); |
2749 Literal* key = property->key(); | 2750 Literal* key = property->key(); |
2750 Expression* value = property->value(); | 2751 Expression* value = property->value(); |
2751 switch (property->kind()) { | 2752 switch (property->kind()) { |
2752 case ObjectLiteral::Property::CONSTANT: | 2753 case ObjectLiteral::Property::CONSTANT: |
2753 break; | 2754 break; |
2754 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2755 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2755 if (property->value()->AsMaterializedLiteral()->is_simple()) break; | 2756 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; |
2756 // else fall through | 2757 // else fall through |
2757 case ObjectLiteral::Property::COMPUTED: // fall through | 2758 case ObjectLiteral::Property::COMPUTED: // fall through |
2758 case ObjectLiteral::Property::PROTOTYPE: { | 2759 case ObjectLiteral::Property::PROTOTYPE: { |
2759 frame_->EmitPush(r0); // dup the result | 2760 frame_->EmitPush(r0); // dup the result |
2760 LoadAndSpill(key); | 2761 LoadAndSpill(key); |
2761 LoadAndSpill(value); | 2762 LoadAndSpill(value); |
2762 frame_->CallRuntime(Runtime::kSetProperty, 3); | 2763 frame_->CallRuntime(Runtime::kSetProperty, 3); |
2763 // restore r0 | 2764 // restore r0 |
2764 __ ldr(r0, frame_->Top()); | 2765 __ ldr(r0, frame_->Top()); |
2765 break; | 2766 break; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 } | 2872 } |
2872 frame_->CallRuntime(clone_function_id, 1); | 2873 frame_->CallRuntime(clone_function_id, 1); |
2873 frame_->EmitPush(r0); // save the result | 2874 frame_->EmitPush(r0); // save the result |
2874 // r0: cloned object literal | 2875 // r0: cloned object literal |
2875 | 2876 |
2876 // Generate code to set the elements in the array that are not | 2877 // Generate code to set the elements in the array that are not |
2877 // literals. | 2878 // literals. |
2878 for (int i = 0; i < node->values()->length(); i++) { | 2879 for (int i = 0; i < node->values()->length(); i++) { |
2879 Expression* value = node->values()->at(i); | 2880 Expression* value = node->values()->at(i); |
2880 | 2881 |
2881 // If value is literal the property value is already | 2882 // If value is a literal the property value is already set in the |
2882 // set in the boilerplate object. | 2883 // boilerplate object. |
2883 if (value->AsLiteral() == NULL) { | 2884 if (value->AsLiteral() != NULL) continue; |
2884 // The property must be set by generated code. | 2885 // If value is a materialized literal the property value is already set |
2885 LoadAndSpill(value); | 2886 // in the boilerplate object if it is simple. |
2886 frame_->EmitPop(r0); | 2887 if (CompileTimeValue::IsCompileTimeValue(value)) continue; |
2887 | 2888 |
2888 // Fetch the object literal | 2889 // The property must be set by generated code. |
2889 __ ldr(r1, frame_->Top()); | 2890 LoadAndSpill(value); |
2890 // Get the elements array. | 2891 frame_->EmitPop(r0); |
2891 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); | |
2892 | 2892 |
2893 // Write to the indexed properties array. | 2893 // Fetch the object literal. |
2894 int offset = i * kPointerSize + Array::kHeaderSize; | 2894 __ ldr(r1, frame_->Top()); |
2895 __ str(r0, FieldMemOperand(r1, offset)); | 2895 // Get the elements array. |
| 2896 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
2896 | 2897 |
2897 // Update the write barrier for the array address. | 2898 // Write to the indexed properties array. |
2898 __ mov(r3, Operand(offset)); | 2899 int offset = i * kPointerSize + Array::kHeaderSize; |
2899 __ RecordWrite(r1, r3, r2); | 2900 __ str(r0, FieldMemOperand(r1, offset)); |
2900 } | 2901 |
| 2902 // Update the write barrier for the array address. |
| 2903 __ mov(r3, Operand(offset)); |
| 2904 __ RecordWrite(r1, r3, r2); |
2901 } | 2905 } |
2902 ASSERT(frame_->height() == original_height + 1); | 2906 ASSERT(frame_->height() == original_height + 1); |
2903 } | 2907 } |
2904 | 2908 |
2905 | 2909 |
2906 void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) { | 2910 void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) { |
2907 #ifdef DEBUG | 2911 #ifdef DEBUG |
2908 int original_height = frame_->height(); | 2912 int original_height = frame_->height(); |
2909 #endif | 2913 #endif |
2910 ASSERT(!in_spilled_code()); | 2914 ASSERT(!in_spilled_code()); |
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5217 __ mov(r2, Operand(0)); | 5221 __ mov(r2, Operand(0)); |
5218 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 5222 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
5219 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 5223 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
5220 RelocInfo::CODE_TARGET); | 5224 RelocInfo::CODE_TARGET); |
5221 } | 5225 } |
5222 | 5226 |
5223 | 5227 |
5224 #undef __ | 5228 #undef __ |
5225 | 5229 |
5226 } } // namespace v8::internal | 5230 } } // namespace v8::internal |
OLD | NEW |