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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
55 : isolate_(script->GetIsolate()), | 55 : isolate_(script->GetIsolate()), |
56 flags_(LanguageModeField::encode(CLASSIC_MODE)), | 56 flags_(LanguageModeField::encode(CLASSIC_MODE)), |
57 function_(NULL), | 57 function_(NULL), |
58 scope_(NULL), | 58 scope_(NULL), |
59 global_scope_(NULL), | 59 global_scope_(NULL), |
60 script_(script), | 60 script_(script), |
61 extension_(NULL), | 61 extension_(NULL), |
62 pre_parse_data_(NULL), | 62 pre_parse_data_(NULL), |
63 osr_ast_id_(AstNode::kNoNumber), | 63 osr_ast_id_(AstNode::kNoNumber), |
64 zone_(zone), | 64 zone_(zone) { |
65 deferred_handles_(NULL) { | |
66 Initialize(BASE); | 65 Initialize(BASE); |
67 } | 66 } |
68 | 67 |
69 | 68 |
70 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 69 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
71 Zone* zone) | 70 Zone* zone) |
72 : isolate_(shared_info->GetIsolate()), | 71 : isolate_(shared_info->GetIsolate()), |
73 flags_(LanguageModeField::encode(CLASSIC_MODE) | | 72 flags_(LanguageModeField::encode(CLASSIC_MODE) | |
74 IsLazy::encode(true)), | 73 IsLazy::encode(true)), |
75 function_(NULL), | 74 function_(NULL), |
76 scope_(NULL), | 75 scope_(NULL), |
77 global_scope_(NULL), | 76 global_scope_(NULL), |
78 shared_info_(shared_info), | 77 shared_info_(shared_info), |
79 script_(Handle<Script>(Script::cast(shared_info->script()))), | 78 script_(Handle<Script>(Script::cast(shared_info->script()))), |
80 extension_(NULL), | 79 extension_(NULL), |
81 pre_parse_data_(NULL), | 80 pre_parse_data_(NULL), |
82 osr_ast_id_(AstNode::kNoNumber), | 81 osr_ast_id_(AstNode::kNoNumber), |
83 zone_(zone), | 82 zone_(zone) { |
84 deferred_handles_(NULL) { | |
85 Initialize(BASE); | 83 Initialize(BASE); |
86 } | 84 } |
87 | 85 |
88 | 86 |
89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) | 87 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) |
90 : isolate_(closure->GetIsolate()), | 88 : isolate_(closure->GetIsolate()), |
91 flags_(LanguageModeField::encode(CLASSIC_MODE) | | 89 flags_(LanguageModeField::encode(CLASSIC_MODE) | |
92 IsLazy::encode(true)), | 90 IsLazy::encode(true)), |
93 function_(NULL), | 91 function_(NULL), |
94 scope_(NULL), | 92 scope_(NULL), |
95 global_scope_(NULL), | 93 global_scope_(NULL), |
96 closure_(closure), | 94 closure_(closure), |
97 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 95 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
98 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 96 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
99 extension_(NULL), | 97 extension_(NULL), |
100 pre_parse_data_(NULL), | 98 pre_parse_data_(NULL), |
101 osr_ast_id_(AstNode::kNoNumber), | 99 osr_ast_id_(AstNode::kNoNumber), |
102 zone_(zone), | 100 zone_(zone) { |
103 deferred_handles_(NULL) { | |
104 Initialize(BASE); | 101 Initialize(BASE); |
105 } | 102 } |
106 | 103 |
107 | 104 |
108 CompilationInfo::~CompilationInfo() { | |
109 delete deferred_handles_; | |
110 } | |
111 | |
112 | |
113 // Disable optimization for the rest of the compilation pipeline. | 105 // Disable optimization for the rest of the compilation pipeline. |
114 void CompilationInfo::DisableOptimization() { | 106 void CompilationInfo::DisableOptimization() { |
115 bool is_optimizable_closure = | 107 bool is_optimizable_closure = |
116 FLAG_optimize_closures && | 108 FLAG_optimize_closures && |
117 closure_.is_null() && | 109 closure_.is_null() && |
118 !scope_->HasTrivialOuterContext() && | 110 !scope_->HasTrivialOuterContext() && |
119 !scope_->outer_scope_calls_non_strict_eval() && | 111 !scope_->outer_scope_calls_non_strict_eval() && |
120 !scope_->inside_with(); | 112 !scope_->inside_with(); |
121 SetMode(is_optimizable_closure ? BASE : NONOPT); | 113 SetMode(is_optimizable_closure ? BASE : NONOPT); |
122 } | 114 } |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 } | 857 } |
866 } | 858 } |
867 | 859 |
868 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 860 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
869 Handle<Script>(info->script()), | 861 Handle<Script>(info->script()), |
870 Handle<Code>(info->code()), | 862 Handle<Code>(info->code()), |
871 info)); | 863 info)); |
872 } | 864 } |
873 | 865 |
874 } } // namespace v8::internal | 866 } } // namespace v8::internal |
OLD | NEW |