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

Side by Side Diff: src/liveedit.h

Issue 235083002: Reland "Handlify GetProperty." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 8 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/isolate.cc ('k') | src/liveedit.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 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 protected: 209 protected:
210 void SetField(int field_position, Handle<Object> value) { 210 void SetField(int field_position, Handle<Object> value) {
211 JSObject::SetElement(array_, field_position, value, NONE, SLOPPY).Assert(); 211 JSObject::SetElement(array_, field_position, value, NONE, SLOPPY).Assert();
212 } 212 }
213 213
214 void SetSmiValueField(int field_position, int value) { 214 void SetSmiValueField(int field_position, int value) {
215 SetField(field_position, Handle<Smi>(Smi::FromInt(value), isolate())); 215 SetField(field_position, Handle<Smi>(Smi::FromInt(value), isolate()));
216 } 216 }
217 217
218 Handle<Object> GetField(int field_position) { 218 Handle<Object> GetField(int field_position) {
219 return Object::GetElementNoExceptionThrown( 219 return Object::GetElement(
220 isolate(), array_, field_position); 220 isolate(), array_, field_position).ToHandleChecked();
221 } 221 }
222 222
223 int GetSmiValueField(int field_position) { 223 int GetSmiValueField(int field_position) {
224 Handle<Object> res = GetField(field_position); 224 Handle<Object> res = GetField(field_position);
225 return Handle<Smi>::cast(res)->value(); 225 return Handle<Smi>::cast(res)->value();
226 } 226 }
227 227
228 private: 228 private:
229 Handle<JSArray> array_; 229 Handle<JSArray> array_;
230 }; 230 };
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 }; 290 };
291 291
292 292
293 // Wraps SharedFunctionInfo along with some of its fields for passing it 293 // Wraps SharedFunctionInfo along with some of its fields for passing it
294 // back to JavaScript. SharedFunctionInfo object itself is additionally 294 // back to JavaScript. SharedFunctionInfo object itself is additionally
295 // wrapped into BlindReference for sanitizing reasons. 295 // wrapped into BlindReference for sanitizing reasons.
296 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { 296 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> {
297 public: 297 public:
298 static bool IsInstance(Handle<JSArray> array) { 298 static bool IsInstance(Handle<JSArray> array) {
299 return array->length() == Smi::FromInt(kSize_) && 299 return array->length() == Smi::FromInt(kSize_) &&
300 Object::GetElementNoExceptionThrown( 300 Object::GetElement(array->GetIsolate(), array, kSharedInfoOffset_)
301 array->GetIsolate(), array, kSharedInfoOffset_)->IsJSValue(); 301 .ToHandleChecked()->IsJSValue();
302 } 302 }
303 303
304 explicit SharedInfoWrapper(Handle<JSArray> array) 304 explicit SharedInfoWrapper(Handle<JSArray> array)
305 : JSArrayBasedStruct<SharedInfoWrapper>(array) { 305 : JSArrayBasedStruct<SharedInfoWrapper>(array) {
306 } 306 }
307 307
308 void SetProperties(Handle<String> name, 308 void SetProperties(Handle<String> name,
309 int start_position, 309 int start_position,
310 int end_position, 310 int end_position,
311 Handle<SharedFunctionInfo> info); 311 Handle<SharedFunctionInfo> info);
312 312
313 Handle<SharedFunctionInfo> GetInfo(); 313 Handle<SharedFunctionInfo> GetInfo();
314 314
315 private: 315 private:
316 static const int kFunctionNameOffset_ = 0; 316 static const int kFunctionNameOffset_ = 0;
317 static const int kStartPositionOffset_ = 1; 317 static const int kStartPositionOffset_ = 1;
318 static const int kEndPositionOffset_ = 2; 318 static const int kEndPositionOffset_ = 2;
319 static const int kSharedInfoOffset_ = 3; 319 static const int kSharedInfoOffset_ = 3;
320 static const int kSize_ = 4; 320 static const int kSize_ = 4;
321 321
322 friend class JSArrayBasedStruct<SharedInfoWrapper>; 322 friend class JSArrayBasedStruct<SharedInfoWrapper>;
323 }; 323 };
324 324
325 #endif // ENABLE_DEBUGGER_SUPPORT 325 #endif // ENABLE_DEBUGGER_SUPPORT
326 326
327 327
328 } } // namespace v8::internal 328 } } // namespace v8::internal
329 329
330 #endif /* V*_LIVEEDIT_H_ */ 330 #endif /* V*_LIVEEDIT_H_ */
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698