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

Side by Side Diff: src/liveedit.h

Issue 270273005: Harden yet more runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/debug.cc ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')
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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_LIVEEDIT_H_ 5 #ifndef V8_LIVEEDIT_H_
6 #define V8_LIVEEDIT_H_ 6 #define V8_LIVEEDIT_H_
7 7
8 8
9 9
10 // Live Edit feature implementation. 10 // Live Edit feature implementation.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 friend class JSArrayBasedStruct<FunctionInfoWrapper>; 271 friend class JSArrayBasedStruct<FunctionInfoWrapper>;
272 }; 272 };
273 273
274 274
275 // Wraps SharedFunctionInfo along with some of its fields for passing it 275 // Wraps SharedFunctionInfo along with some of its fields for passing it
276 // back to JavaScript. SharedFunctionInfo object itself is additionally 276 // back to JavaScript. SharedFunctionInfo object itself is additionally
277 // wrapped into BlindReference for sanitizing reasons. 277 // wrapped into BlindReference for sanitizing reasons.
278 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { 278 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> {
279 public: 279 public:
280 static bool IsInstance(Handle<JSArray> array) { 280 static bool IsInstance(Handle<JSArray> array) {
281 return array->length() == Smi::FromInt(kSize_) && 281 if (array->length() != Smi::FromInt(kSize_)) return false;
282 Object::GetElement(array->GetIsolate(), array, kSharedInfoOffset_) 282 Isolate* iso = array->GetIsolate();
Dmitry Lomov (no reviews) 2014/05/07 14:47:18 nit: iso -> isolate ('iso' is never used as an abb
Jakob Kummerow 2014/05/08 09:32:57 Done.
283 .ToHandleChecked()->IsJSValue(); 283 Handle<Object> element(
284 Object::GetElement(iso, array, kSharedInfoOffset_).ToHandleChecked());
285 if (!element->IsJSValue()) return false;
286 return Handle<JSValue>::cast(element)->value()->IsSharedFunctionInfo();
284 } 287 }
285 288
286 explicit SharedInfoWrapper(Handle<JSArray> array) 289 explicit SharedInfoWrapper(Handle<JSArray> array)
287 : JSArrayBasedStruct<SharedInfoWrapper>(array) { 290 : JSArrayBasedStruct<SharedInfoWrapper>(array) {
288 } 291 }
289 292
290 void SetProperties(Handle<String> name, 293 void SetProperties(Handle<String> name,
291 int start_position, 294 int start_position,
292 int end_position, 295 int end_position,
293 Handle<SharedFunctionInfo> info); 296 Handle<SharedFunctionInfo> info);
294 297
295 Handle<SharedFunctionInfo> GetInfo(); 298 Handle<SharedFunctionInfo> GetInfo();
296 299
297 private: 300 private:
298 static const int kFunctionNameOffset_ = 0; 301 static const int kFunctionNameOffset_ = 0;
299 static const int kStartPositionOffset_ = 1; 302 static const int kStartPositionOffset_ = 1;
300 static const int kEndPositionOffset_ = 2; 303 static const int kEndPositionOffset_ = 2;
301 static const int kSharedInfoOffset_ = 3; 304 static const int kSharedInfoOffset_ = 3;
302 static const int kSize_ = 4; 305 static const int kSize_ = 4;
303 306
304 friend class JSArrayBasedStruct<SharedInfoWrapper>; 307 friend class JSArrayBasedStruct<SharedInfoWrapper>;
305 }; 308 };
306 309
307 } } // namespace v8::internal 310 } } // namespace v8::internal
308 311
309 #endif /* V*_LIVEEDIT_H_ */ 312 #endif /* V*_LIVEEDIT_H_ */
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698