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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 current->Exit(&context_length); | 1000 current->Exit(&context_length); |
1001 DCHECK_EQ(-1, context_length); | 1001 DCHECK_EQ(-1, context_length); |
1002 current->AsTryFinally()->deferred_commands()->RecordReturn(); | 1002 current->AsTryFinally()->deferred_commands()->RecordReturn(); |
1003 return; | 1003 return; |
1004 } | 1004 } |
1005 current = current->Exit(&context_length); | 1005 current = current->Exit(&context_length); |
1006 } | 1006 } |
1007 EmitReturnSequence(); | 1007 EmitReturnSequence(); |
1008 } | 1008 } |
1009 | 1009 |
| 1010 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
| 1011 bool pretenure) { |
| 1012 // Use the fast case closure allocation code that allocates in new |
| 1013 // space for nested functions that don't need literals cloning. If |
| 1014 // we're running with the --always-opt or the --prepare-always-opt |
| 1015 // flag, we need to use the runtime function so that the new function |
| 1016 // we are creating here gets a chance to have its code optimized and |
| 1017 // doesn't just get a copy of the existing unoptimized code. |
| 1018 if (!FLAG_always_opt && |
| 1019 !FLAG_prepare_always_opt && |
| 1020 !pretenure && |
| 1021 scope()->is_function_scope() && |
| 1022 info->num_literals() == 0) { |
| 1023 FastNewClosureStub stub(isolate(), info->language_mode(), info->kind()); |
| 1024 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); |
| 1025 __ CallStub(&stub); |
| 1026 } else { |
| 1027 __ Push(info); |
| 1028 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured |
| 1029 : Runtime::kNewClosure); |
| 1030 } |
| 1031 context()->Plug(result_register()); |
| 1032 } |
| 1033 |
1010 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1034 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1011 SetExpressionPosition(prop); | 1035 SetExpressionPosition(prop); |
1012 Literal* key = prop->key()->AsLiteral(); | 1036 Literal* key = prop->key()->AsLiteral(); |
1013 DCHECK(!key->value()->IsSmi()); | 1037 DCHECK(!key->value()->IsSmi()); |
1014 DCHECK(!prop->IsSuperAccess()); | 1038 DCHECK(!prop->IsSuperAccess()); |
1015 | 1039 |
1016 __ Move(LoadDescriptor::NameRegister(), key->value()); | 1040 __ Move(LoadDescriptor::NameRegister(), key->value()); |
1017 __ Move(LoadDescriptor::SlotRegister(), | 1041 __ Move(LoadDescriptor::SlotRegister(), |
1018 SmiFromSlot(prop->PropertyFeedbackSlot())); | 1042 SmiFromSlot(prop->PropertyFeedbackSlot())); |
1019 CallLoadIC(NOT_INSIDE_TYPEOF); | 1043 CallLoadIC(NOT_INSIDE_TYPEOF); |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1919 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1896 var->initializer_position() >= proxy->position(); | 1920 var->initializer_position() >= proxy->position(); |
1897 } | 1921 } |
1898 | 1922 |
1899 | 1923 |
1900 #undef __ | 1924 #undef __ |
1901 | 1925 |
1902 | 1926 |
1903 } // namespace internal | 1927 } // namespace internal |
1904 } // namespace v8 | 1928 } // namespace v8 |
OLD | NEW |