Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: src/compiler.cc

Issue 10640012: Add a second kind of HandleScope that ties the lifetime of Handles created in its scope to the life… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 hidden_extensions_(NULL) {
65 Initialize(BASE); 66 Initialize(BASE);
66 } 67 }
67 68
68 69
69 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, 70 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
70 Zone* zone) 71 Zone* zone)
71 : isolate_(shared_info->GetIsolate()), 72 : isolate_(shared_info->GetIsolate()),
72 flags_(LanguageModeField::encode(CLASSIC_MODE) | 73 flags_(LanguageModeField::encode(CLASSIC_MODE) |
73 IsLazy::encode(true)), 74 IsLazy::encode(true)),
74 function_(NULL), 75 function_(NULL),
75 scope_(NULL), 76 scope_(NULL),
76 global_scope_(NULL), 77 global_scope_(NULL),
77 shared_info_(shared_info), 78 shared_info_(shared_info),
78 script_(Handle<Script>(Script::cast(shared_info->script()))), 79 script_(Handle<Script>(Script::cast(shared_info->script()))),
79 extension_(NULL), 80 extension_(NULL),
80 pre_parse_data_(NULL), 81 pre_parse_data_(NULL),
81 osr_ast_id_(AstNode::kNoNumber), 82 osr_ast_id_(AstNode::kNoNumber),
82 zone_(zone) { 83 zone_(zone),
84 hidden_extensions_(NULL) {
83 Initialize(BASE); 85 Initialize(BASE);
84 } 86 }
85 87
86 88
87 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) 89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone)
88 : isolate_(closure->GetIsolate()), 90 : isolate_(closure->GetIsolate()),
89 flags_(LanguageModeField::encode(CLASSIC_MODE) | 91 flags_(LanguageModeField::encode(CLASSIC_MODE) |
90 IsLazy::encode(true)), 92 IsLazy::encode(true)),
91 function_(NULL), 93 function_(NULL),
92 scope_(NULL), 94 scope_(NULL),
93 global_scope_(NULL), 95 global_scope_(NULL),
94 closure_(closure), 96 closure_(closure),
95 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), 97 shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
96 script_(Handle<Script>(Script::cast(shared_info_->script()))), 98 script_(Handle<Script>(Script::cast(shared_info_->script()))),
97 extension_(NULL), 99 extension_(NULL),
98 pre_parse_data_(NULL), 100 pre_parse_data_(NULL),
99 osr_ast_id_(AstNode::kNoNumber), 101 osr_ast_id_(AstNode::kNoNumber),
100 zone_(zone) { 102 zone_(zone),
103 hidden_extensions_(NULL) {
101 Initialize(BASE); 104 Initialize(BASE);
102 } 105 }
103 106
104 107
108 CompilationInfo::~CompilationInfo() {
109 if (hidden_extensions_) {
110 HandleScopeImplementer* impl = isolate_->handle_scope_implementer();
111 impl->DeleteHiddenExtensions(hidden_extensions_);
112 }
113 }
114
115
105 // Disable optimization for the rest of the compilation pipeline. 116 // Disable optimization for the rest of the compilation pipeline.
106 void CompilationInfo::DisableOptimization() { 117 void CompilationInfo::DisableOptimization() {
107 bool is_optimizable_closure = 118 bool is_optimizable_closure =
108 FLAG_optimize_closures && 119 FLAG_optimize_closures &&
109 closure_.is_null() && 120 closure_.is_null() &&
110 !scope_->HasTrivialOuterContext() && 121 !scope_->HasTrivialOuterContext() &&
111 !scope_->outer_scope_calls_non_strict_eval() && 122 !scope_->outer_scope_calls_non_strict_eval() &&
112 !scope_->inside_with(); 123 !scope_->inside_with();
113 SetMode(is_optimizable_closure ? BASE : NONOPT); 124 SetMode(is_optimizable_closure ? BASE : NONOPT);
114 } 125 }
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 882 }
872 } 883 }
873 884
874 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 885 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
875 Handle<Script>(info->script()), 886 Handle<Script>(info->script()),
876 Handle<Code>(info->code()), 887 Handle<Code>(info->code()),
877 info)); 888 info));
878 } 889 }
879 890
880 } } // namespace v8::internal 891 } } // namespace v8::internal
OLDNEW
« src/compiler.h ('K') | « src/compiler.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698