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

Side by Side Diff: test/cctest/test-decls.cc

Issue 172089: Fix error in test-heap.cc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 | « test/cctest/cctest.status ('k') | test/cctest/test-heap.cc » ('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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DeclarationContext::DeclarationContext() 104 DeclarationContext::DeclarationContext()
105 : is_initialized_(false), get_count_(0), set_count_(0), has_count_(0) { 105 : is_initialized_(false), get_count_(0), set_count_(0), has_count_(0) {
106 // Do nothing. 106 // Do nothing.
107 } 107 }
108 108
109 109
110 void DeclarationContext::InitializeIfNeeded() { 110 void DeclarationContext::InitializeIfNeeded() {
111 if (is_initialized_) return; 111 if (is_initialized_) return;
112 HandleScope scope; 112 HandleScope scope;
113 Local<FunctionTemplate> function = FunctionTemplate::New(); 113 Local<FunctionTemplate> function = FunctionTemplate::New();
114 Local<Value> data = Integer::New(reinterpret_cast<intptr_t>(this)); 114 Local<Value> data = External::New(this);
115 GetHolder(function)->SetNamedPropertyHandler(&HandleGet, 115 GetHolder(function)->SetNamedPropertyHandler(&HandleGet,
116 &HandleSet, 116 &HandleSet,
117 &HandleHas, 117 &HandleHas,
118 0, 0, 118 0, 0,
119 data); 119 data);
120 context_ = Context::New(0, function->InstanceTemplate(), Local<Value>()); 120 context_ = Context::New(0, function->InstanceTemplate(), Local<Value>());
121 context_->Enter(); 121 context_->Enter();
122 is_initialized_ = true; 122 is_initialized_ = true;
123 } 123 }
124 124
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 v8::Handle<Boolean> DeclarationContext::HandleHas(Local<String> key, 173 v8::Handle<Boolean> DeclarationContext::HandleHas(Local<String> key,
174 const AccessorInfo& info) { 174 const AccessorInfo& info) {
175 DeclarationContext* context = GetInstance(info); 175 DeclarationContext* context = GetInstance(info);
176 context->has_count_++; 176 context->has_count_++;
177 return context->Has(key); 177 return context->Has(key);
178 } 178 }
179 179
180 180
181 DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) { 181 DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) {
182 Local<Value> data = info.Data(); 182 return static_cast<DeclarationContext*>(External::Unwrap(info.Data()));
183 return reinterpret_cast<DeclarationContext*>(Int32::Cast(*data)->Value());
184 } 183 }
185 184
186 185
187 v8::Handle<Value> DeclarationContext::Get(Local<String> key) { 186 v8::Handle<Value> DeclarationContext::Get(Local<String> key) {
188 return v8::Handle<Value>(); 187 return v8::Handle<Value>();
189 } 188 }
190 189
191 190
192 v8::Handle<Value> DeclarationContext::Set(Local<String> key, 191 v8::Handle<Value> DeclarationContext::Set(Local<String> key,
193 Local<Value> value) { 192 Local<Value> value) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 HandleScope scope; 584 HandleScope scope;
586 585
587 { AbsentInPrototypeContext context; 586 { AbsentInPrototypeContext context;
588 context.Check("if (false) { var x = 0; }; x", 587 context.Check("if (false) { var x = 0; }; x",
589 0, 588 0,
590 0, 589 0,
591 1, // declaration 590 1, // declaration
592 EXPECT_RESULT, Undefined()); 591 EXPECT_RESULT, Undefined());
593 } 592 }
594 } 593 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698