| 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 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2592 } |  2592 } | 
|  2593  |  2593  | 
|  2594 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { |  2594 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 
|  2595   assembler->Return( |  2595   assembler->Return( | 
|  2596       Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); |  2596       Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); | 
|  2597 } |  2597 } | 
|  2598  |  2598  | 
|  2599 // static |  2599 // static | 
|  2600 compiler::Node* FastNewFunctionContextStub::Generate( |  2600 compiler::Node* FastNewFunctionContextStub::Generate( | 
|  2601     CodeStubAssembler* assembler, compiler::Node* function, |  2601     CodeStubAssembler* assembler, compiler::Node* function, | 
|  2602     compiler::Node* slots, compiler::Node* context) { |  2602     compiler::Node* slots, compiler::Node* context, bool for_eval) { | 
|  2603   typedef compiler::Node Node; |  2603   typedef compiler::Node Node; | 
|  2604  |  2604  | 
|  2605   Node* min_context_slots = |  2605   Node* min_context_slots = | 
|  2606       assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); |  2606       assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); | 
|  2607   Node* length = assembler->Int32Add(slots, min_context_slots); |  2607   Node* length = assembler->Int32Add(slots, min_context_slots); | 
|  2608   Node* size = assembler->Int32Add( |  2608   Node* size = assembler->Int32Add( | 
|  2609       assembler->Word32Shl(length, assembler->Int32Constant(kPointerSizeLog2)), |  2609       assembler->Word32Shl(length, assembler->Int32Constant(kPointerSizeLog2)), | 
|  2610       assembler->Int32Constant(FixedArray::kHeaderSize)); |  2610       assembler->Int32Constant(FixedArray::kHeaderSize)); | 
|  2611  |  2611  | 
|  2612   // Create a new closure from the given function info in new space |  2612   // Create a new closure from the given function info in new space | 
|  2613   Node* function_context = assembler->Allocate(size); |  2613   Node* function_context = assembler->Allocate(size); | 
|  2614  |  2614  | 
|  2615   Isolate* isolate = assembler->isolate(); |  2615   Isolate* isolate = assembler->isolate(); | 
|  2616   assembler->StoreMapNoWriteBarrier( |  2616   Handle<Map> map = for_eval ? isolate->factory()->eval_context_map() | 
|  2617       function_context, |  2617                              : isolate->factory()->function_context_map(); | 
|  2618       assembler->HeapConstant(isolate->factory()->function_context_map())); |  2618   assembler->StoreMapNoWriteBarrier(function_context, | 
 |  2619                                     assembler->HeapConstant(map)); | 
|  2619   assembler->StoreObjectFieldNoWriteBarrier(function_context, |  2620   assembler->StoreObjectFieldNoWriteBarrier(function_context, | 
|  2620                                             Context::kLengthOffset, |  2621                                             Context::kLengthOffset, | 
|  2621                                             assembler->SmiFromWord32(length)); |  2622                                             assembler->SmiFromWord32(length)); | 
|  2622  |  2623  | 
|  2623   // Set up the fixed slots. |  2624   // Set up the fixed slots. | 
|  2624   assembler->StoreFixedArrayElement( |  2625   assembler->StoreFixedArrayElement( | 
|  2625       function_context, assembler->Int32Constant(Context::CLOSURE_INDEX), |  2626       function_context, assembler->Int32Constant(Context::CLOSURE_INDEX), | 
|  2626       function, SKIP_WRITE_BARRIER); |  2627       function, SKIP_WRITE_BARRIER); | 
|  2627   assembler->StoreFixedArrayElement( |  2628   assembler->StoreFixedArrayElement( | 
|  2628       function_context, assembler->Int32Constant(Context::PREVIOUS_INDEX), |  2629       function_context, assembler->Int32Constant(Context::PREVIOUS_INDEX), | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|  2649   return function_context; |  2650   return function_context; | 
|  2650 } |  2651 } | 
|  2651  |  2652  | 
|  2652 void FastNewFunctionContextStub::GenerateAssembly( |  2653 void FastNewFunctionContextStub::GenerateAssembly( | 
|  2653     CodeStubAssembler* assembler) const { |  2654     CodeStubAssembler* assembler) const { | 
|  2654   typedef compiler::Node Node; |  2655   typedef compiler::Node Node; | 
|  2655   Node* function = assembler->Parameter(Descriptor::kFunction); |  2656   Node* function = assembler->Parameter(Descriptor::kFunction); | 
|  2656   Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots); |  2657   Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots); | 
|  2657   Node* context = assembler->Parameter(Descriptor::kContext); |  2658   Node* context = assembler->Parameter(Descriptor::kContext); | 
|  2658  |  2659  | 
|  2659   assembler->Return(Generate(assembler, function, slots, context)); |  2660   assembler->Return(Generate(assembler, function, slots, context, for_eval())); | 
|  2660 } |  2661 } | 
|  2661  |  2662  | 
|  2662 // static |  2663 // static | 
|  2663 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, |  2664 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, | 
|  2664                                               compiler::Node* closure, |  2665                                               compiler::Node* closure, | 
|  2665                                               compiler::Node* literal_index, |  2666                                               compiler::Node* literal_index, | 
|  2666                                               compiler::Node* pattern, |  2667                                               compiler::Node* pattern, | 
|  2667                                               compiler::Node* flags, |  2668                                               compiler::Node* flags, | 
|  2668                                               compiler::Node* context) { |  2669                                               compiler::Node* context) { | 
|  2669   typedef CodeStubAssembler::Label Label; |  2670   typedef CodeStubAssembler::Label Label; | 
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3243  |  3244  | 
|  3244   if (type == MachineType::Pointer()) { |  3245   if (type == MachineType::Pointer()) { | 
|  3245     return Representation::External(); |  3246     return Representation::External(); | 
|  3246   } |  3247   } | 
|  3247  |  3248  | 
|  3248   return Representation::Tagged(); |  3249   return Representation::Tagged(); | 
|  3249 } |  3250 } | 
|  3250  |  3251  | 
|  3251 }  // namespace internal |  3252 }  // namespace internal | 
|  3252 }  // namespace v8 |  3253 }  // namespace v8 | 
| OLD | NEW |