OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 CodeStubAssembler assembler(state); | 2105 CodeStubAssembler assembler(state); |
2106 | 2106 |
2107 assembler.Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d", | 2107 assembler.Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d", |
2108 context_index(), slot_index()); | 2108 context_index(), slot_index()); |
2109 | 2109 |
2110 Node* value = assembler.Parameter(Descriptor::kValue); | 2110 Node* value = assembler.Parameter(Descriptor::kValue); |
2111 Node* context = assembler.Parameter(Descriptor::kContext); | 2111 Node* context = assembler.Parameter(Descriptor::kContext); |
2112 | 2112 |
2113 Node* script_context = assembler.LoadScriptContext(context, context_index()); | 2113 Node* script_context = assembler.LoadScriptContext(context, context_index()); |
2114 assembler.StoreFixedArrayElement( | 2114 assembler.StoreFixedArrayElement( |
2115 script_context, assembler.IntPtrConstant(slot_index()), value, | 2115 script_context, assembler.IntPtrConstant(slot_index()), value); |
2116 UPDATE_WRITE_BARRIER, 0, CodeStubAssembler::INTPTR_PARAMETERS); | |
2117 assembler.Return(value); | 2116 assembler.Return(value); |
2118 } | 2117 } |
2119 | 2118 |
2120 void StoreInterceptorStub::GenerateAssembly( | 2119 void StoreInterceptorStub::GenerateAssembly( |
2121 compiler::CodeAssemblerState* state) const { | 2120 compiler::CodeAssemblerState* state) const { |
2122 typedef compiler::Node Node; | 2121 typedef compiler::Node Node; |
2123 CodeStubAssembler assembler(state); | 2122 CodeStubAssembler assembler(state); |
2124 | 2123 |
2125 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 2124 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2126 Node* name = assembler.Parameter(Descriptor::kName); | 2125 Node* name = assembler.Parameter(Descriptor::kName); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX)); | 2547 Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX)); |
2549 assembler->Goto(&load_map); | 2548 assembler->Goto(&load_map); |
2550 } | 2549 } |
2551 | 2550 |
2552 assembler->Bind(&load_map); | 2551 assembler->Bind(&load_map); |
2553 | 2552 |
2554 // Get the function map in the current native context and set that | 2553 // Get the function map in the current native context and set that |
2555 // as the map of the allocated object. | 2554 // as the map of the allocated object. |
2556 Node* native_context = assembler->LoadNativeContext(context); | 2555 Node* native_context = assembler->LoadNativeContext(context); |
2557 Node* map_slot_value = | 2556 Node* map_slot_value = |
2558 assembler->LoadFixedArrayElement(native_context, map_index.value(), 0, | 2557 assembler->LoadFixedArrayElement(native_context, map_index.value()); |
2559 CodeStubAssembler::INTPTR_PARAMETERS); | |
2560 assembler->StoreMapNoWriteBarrier(result, map_slot_value); | 2558 assembler->StoreMapNoWriteBarrier(result, map_slot_value); |
2561 | 2559 |
2562 // Initialize the rest of the function. | 2560 // Initialize the rest of the function. |
2563 Node* empty_fixed_array = | 2561 Node* empty_fixed_array = |
2564 assembler->HeapConstant(factory->empty_fixed_array()); | 2562 assembler->HeapConstant(factory->empty_fixed_array()); |
2565 Node* empty_literals_array = | 2563 Node* empty_literals_array = |
2566 assembler->HeapConstant(factory->empty_literals_array()); | 2564 assembler->HeapConstant(factory->empty_literals_array()); |
2567 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, | 2565 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, |
2568 empty_fixed_array); | 2566 empty_fixed_array); |
2569 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, | 2567 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( | 3077 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( |
3080 compiler::CodeAssemblerState* state) const { | 3078 compiler::CodeAssemblerState* state) const { |
3081 typedef compiler::Node Node; | 3079 typedef compiler::Node Node; |
3082 CodeStubAssembler assembler(state); | 3080 CodeStubAssembler assembler(state); |
3083 Node* array_map = | 3081 Node* array_map = |
3084 assembler.LoadObjectField(assembler.Parameter(Descriptor::kFunction), | 3082 assembler.LoadObjectField(assembler.Parameter(Descriptor::kFunction), |
3085 JSFunction::kPrototypeOrInitialMapOffset); | 3083 JSFunction::kPrototypeOrInitialMapOffset); |
3086 Node* array = assembler.AllocateJSArray( | 3084 Node* array = assembler.AllocateJSArray( |
3087 elements_kind(), array_map, | 3085 elements_kind(), array_map, |
3088 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), | 3086 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), |
3089 assembler.SmiConstant(Smi::kZero), nullptr); | 3087 assembler.SmiConstant(Smi::kZero)); |
3090 assembler.Return(array); | 3088 assembler.Return(array); |
3091 } | 3089 } |
3092 | 3090 |
3093 namespace { | 3091 namespace { |
3094 | 3092 |
3095 template <typename Descriptor> | 3093 template <typename Descriptor> |
3096 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, | 3094 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, |
3097 ElementsKind elements_kind, | 3095 ElementsKind elements_kind, |
3098 compiler::Node* array_map, | 3096 compiler::Node* array_map, |
3099 compiler::Node* allocation_site, | 3097 compiler::Node* allocation_site, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 } | 3215 } |
3218 | 3216 |
3219 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 3217 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
3220 : PlatformCodeStub(isolate) {} | 3218 : PlatformCodeStub(isolate) {} |
3221 | 3219 |
3222 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 3220 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
3223 : PlatformCodeStub(isolate) {} | 3221 : PlatformCodeStub(isolate) {} |
3224 | 3222 |
3225 } // namespace internal | 3223 } // namespace internal |
3226 } // namespace v8 | 3224 } // namespace v8 |
OLD | NEW |