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

Side by Side Diff: src/compiler.cc

Issue 10697094: 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, 5 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
« no previous file with comments | « src/compiler.h ('k') | src/handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 deferred_handles_(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 deferred_handles_(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 deferred_handles_(NULL) {
101 Initialize(BASE); 104 Initialize(BASE);
102 } 105 }
103 106
104 107
108 CompilationInfo::~CompilationInfo() {
109 delete deferred_handles_;
110 }
111
112
105 // Disable optimization for the rest of the compilation pipeline. 113 // Disable optimization for the rest of the compilation pipeline.
106 void CompilationInfo::DisableOptimization() { 114 void CompilationInfo::DisableOptimization() {
107 bool is_optimizable_closure = 115 bool is_optimizable_closure =
108 FLAG_optimize_closures && 116 FLAG_optimize_closures &&
109 closure_.is_null() && 117 closure_.is_null() &&
110 !scope_->HasTrivialOuterContext() && 118 !scope_->HasTrivialOuterContext() &&
111 !scope_->outer_scope_calls_non_strict_eval() && 119 !scope_->outer_scope_calls_non_strict_eval() &&
112 !scope_->inside_with(); 120 !scope_->inside_with();
113 SetMode(is_optimizable_closure ? BASE : NONOPT); 121 SetMode(is_optimizable_closure ? BASE : NONOPT);
114 } 122 }
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 866 }
859 } 867 }
860 868
861 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 869 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
862 Handle<Script>(info->script()), 870 Handle<Script>(info->script()),
863 Handle<Code>(info->code()), 871 Handle<Code>(info->code()),
864 info)); 872 info));
865 } 873 }
866 874
867 } } // namespace v8::internal 875 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698