| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "scanner-character-streams.h" | 45 #include "scanner-character-streams.h" |
| 46 #include "scopeinfo.h" | 46 #include "scopeinfo.h" |
| 47 #include "scopes.h" | 47 #include "scopes.h" |
| 48 #include "vm-state-inl.h" | 48 #include "vm-state-inl.h" |
| 49 | 49 |
| 50 namespace v8 { | 50 namespace v8 { |
| 51 namespace internal { | 51 namespace internal { |
| 52 | 52 |
| 53 | 53 |
| 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
| 55 : isolate_(script->GetIsolate()), | 55 : flags_(LanguageModeField::encode(CLASSIC_MODE)), |
| 56 flags_(LanguageModeField::encode(CLASSIC_MODE)), | |
| 57 function_(NULL), | |
| 58 scope_(NULL), | |
| 59 global_scope_(NULL), | |
| 60 script_(script), | 56 script_(script), |
| 61 extension_(NULL), | 57 osr_ast_id_(BailoutId::None()) { |
| 62 pre_parse_data_(NULL), | 58 Initialize(zone); |
| 63 osr_ast_id_(BailoutId::None()), | |
| 64 zone_(zone), | |
| 65 deferred_handles_(NULL) { | |
| 66 Initialize(BASE); | |
| 67 } | 59 } |
| 68 | 60 |
| 69 | 61 |
| 70 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 62 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 71 Zone* zone) | 63 Zone* zone) |
| 72 : isolate_(shared_info->GetIsolate()), | 64 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 73 flags_(LanguageModeField::encode(CLASSIC_MODE) | | |
| 74 IsLazy::encode(true)), | |
| 75 function_(NULL), | |
| 76 scope_(NULL), | |
| 77 global_scope_(NULL), | |
| 78 shared_info_(shared_info), | 65 shared_info_(shared_info), |
| 79 script_(Handle<Script>(Script::cast(shared_info->script()))), | 66 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 80 extension_(NULL), | 67 osr_ast_id_(BailoutId::None()) { |
| 81 pre_parse_data_(NULL), | 68 Initialize(zone); |
| 82 osr_ast_id_(BailoutId::None()), | |
| 83 zone_(zone), | |
| 84 deferred_handles_(NULL) { | |
| 85 Initialize(BASE); | |
| 86 } | 69 } |
| 87 | 70 |
| 88 | 71 |
| 89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) | 72 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) |
| 90 : isolate_(closure->GetIsolate()), | 73 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 91 flags_(LanguageModeField::encode(CLASSIC_MODE) | | |
| 92 IsLazy::encode(true)), | |
| 93 function_(NULL), | |
| 94 scope_(NULL), | |
| 95 global_scope_(NULL), | |
| 96 closure_(closure), | 74 closure_(closure), |
| 97 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 75 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 98 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 76 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 99 extension_(NULL), | |
| 100 pre_parse_data_(NULL), | |
| 101 context_(closure->context()), | 77 context_(closure->context()), |
| 102 osr_ast_id_(BailoutId::None()), | 78 osr_ast_id_(BailoutId::None()) { |
| 103 zone_(zone), | 79 Initialize(zone); |
| 104 deferred_handles_(NULL) { | |
| 105 Initialize(BASE); | |
| 106 } | 80 } |
| 107 | 81 |
| 108 | 82 |
| 83 void CompilationInfo::Initialize(Zone* zone) { |
| 84 isolate_ = script_->GetIsolate(); |
| 85 function_ = NULL; |
| 86 scope_ = NULL; |
| 87 global_scope_ = NULL; |
| 88 extension_ = NULL; |
| 89 pre_parse_data_ = NULL; |
| 90 zone_ = zone; |
| 91 deferred_handles_ = NULL; |
| 92 prologue_offset_ = kPrologueOffsetNotSet; |
| 93 mode_ = V8::UseCrankshaft() ? BASE : NONOPT; |
| 94 if (script_->type()->value() == Script::TYPE_NATIVE) { |
| 95 MarkAsNative(); |
| 96 } |
| 97 if (!shared_info_.is_null()) { |
| 98 ASSERT(language_mode() == CLASSIC_MODE); |
| 99 SetLanguageMode(shared_info_->language_mode()); |
| 100 } |
| 101 set_bailout_reason("unknown"); |
| 102 } |
| 103 |
| 104 |
| 109 CompilationInfo::~CompilationInfo() { | 105 CompilationInfo::~CompilationInfo() { |
| 110 delete deferred_handles_; | 106 delete deferred_handles_; |
| 111 } | 107 } |
| 112 | 108 |
| 113 | 109 |
| 114 // Disable optimization for the rest of the compilation pipeline. | 110 // Disable optimization for the rest of the compilation pipeline. |
| 115 void CompilationInfo::DisableOptimization() { | 111 void CompilationInfo::DisableOptimization() { |
| 116 bool is_optimizable_closure = | 112 bool is_optimizable_closure = |
| 117 FLAG_optimize_closures && | 113 FLAG_optimize_closures && |
| 118 closure_.is_null() && | 114 closure_.is_null() && |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 } | 1070 } |
| 1075 } | 1071 } |
| 1076 | 1072 |
| 1077 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1073 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1078 Handle<Script>(info->script()), | 1074 Handle<Script>(info->script()), |
| 1079 Handle<Code>(info->code()), | 1075 Handle<Code>(info->code()), |
| 1080 info)); | 1076 info)); |
| 1081 } | 1077 } |
| 1082 | 1078 |
| 1083 } } // namespace v8::internal | 1079 } } // namespace v8::internal |
| OLD | NEW |