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

Side by Side Diff: src/parser.cc

Issue 6481001: Bypass JS accessors when building error array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Lasse's concerns Created 9 years, 10 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 | « no previous file | test/mjsunit/regress/regress-1130.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3905 matching lines...) Expand 10 before | Expand all | Expand 10 after
3916 Vector< Handle<Object> > arguments = 3916 Vector< Handle<Object> > arguments =
3917 HandleVector<Object>(elements, ARRAY_SIZE(elements)); 3917 HandleVector<Object>(elements, ARRAY_SIZE(elements));
3918 return NewThrowError(Factory::MakeTypeError_symbol(), type, arguments); 3918 return NewThrowError(Factory::MakeTypeError_symbol(), type, arguments);
3919 } 3919 }
3920 3920
3921 3921
3922 Expression* Parser::NewThrowError(Handle<String> constructor, 3922 Expression* Parser::NewThrowError(Handle<String> constructor,
3923 Handle<String> type, 3923 Handle<String> type,
3924 Vector< Handle<Object> > arguments) { 3924 Vector< Handle<Object> > arguments) {
3925 int argc = arguments.length(); 3925 int argc = arguments.length();
3926 Handle<JSArray> array = Factory::NewJSArray(argc, TENURED); 3926 Handle<FixedArray> elements = Factory::NewFixedArray(argc, TENURED);
3927 ASSERT(array->IsJSArray() && array->HasFastElements());
3928 for (int i = 0; i < argc; i++) { 3927 for (int i = 0; i < argc; i++) {
3929 Handle<Object> element = arguments[i]; 3928 Handle<Object> element = arguments[i];
3930 if (!element.is_null()) { 3929 if (!element.is_null()) {
3931 // We know this doesn't cause a GC here because we allocated the JSArray 3930 elements->set(i, *element);
3932 // large enough.
3933 array->SetFastElement(i, *element)->ToObjectUnchecked();
3934 } 3931 }
3935 } 3932 }
3933 Handle<JSArray> array = Factory::NewJSArrayWithElements(elements, TENURED);
3934
3936 ZoneList<Expression*>* args = new ZoneList<Expression*>(2); 3935 ZoneList<Expression*>* args = new ZoneList<Expression*>(2);
3937 args->Add(new Literal(type)); 3936 args->Add(new Literal(type));
3938 args->Add(new Literal(array)); 3937 args->Add(new Literal(array));
3939 return new Throw(new CallRuntime(constructor, NULL, args), 3938 return new Throw(new CallRuntime(constructor, NULL, args),
3940 scanner().location().beg_pos); 3939 scanner().location().beg_pos);
3941 } 3940 }
3942 3941
3943 // ---------------------------------------------------------------------------- 3942 // ----------------------------------------------------------------------------
3944 // JSON 3943 // JSON
3945 3944
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5103 info->is_global(), 5102 info->is_global(),
5104 info->StrictMode()); 5103 info->StrictMode());
5105 } 5104 }
5106 } 5105 }
5107 5106
5108 info->SetFunction(result); 5107 info->SetFunction(result);
5109 return (result != NULL); 5108 return (result != NULL);
5110 } 5109 }
5111 5110
5112 } } // namespace v8::internal 5111 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1130.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698